File: root - text - article - 2019 - 10 - create-a-simple-calculator.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, | English | Home Page | Category: Computing | 324 Views, 19837 Search Bots | 61 Words
| Browse | Archive
![Subscribe to Feed Burner Subscribe to Feed Burner](/images/form/rss.gif)
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, | English | Home Page | Category: Computing | 324 Views, 19837 Search Bots | 61 Words
![Subscribe to Feed Burner Subscribe to Feed Burner](/images/form/rss.gif)
Hi, here's your problem today. This problem was recently asked by Google:
Given a mathematical expression with just single digits, plus signs, negative signs, and brackets, evaluate the expression. Assume the expression is properly formed.
Example:
Input: - ( 3 + ( 2 - 1 ) )
Output: -4
Here's the function signature:
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, | English | Home Page | Cateogry: Computing | 324 Views, 19837 Search Bots | 61 Words Given a mathematical expression with just single digits, plus signs, negative signs, and brackets, evaluate the expression. Assume the expression is properly formed.
Example:
Input: - ( 3 + ( 2 - 1 ) )
Output: -4
Here's the function signature:
def eval(expression):
# Fill this in.
print eval('- (3 + ( 2 - 1 ) )')
# -4
![Subscribe to Feed Burner Subscribe to Feed Burner](/images/form/rss.gif)
Related Articles
- Top K Frequent words
- Algorithm Interview: Subarray With Target Sum
- Sorting a list with 3 unique numbers
- [Daily Problem] Remove Consecutive Nodes that Sum to 0
- Algorithm Interview Question: Find the Single Element in an Array of Duplicates
- Algorithm Interview Question: Max and Min with Limited Comparisons
- Daily Interview Problem: 3 Sum
- Spectrum Master
- Daily Interview Problem: Validate Binary Search Tree
- Algorithm Interview: Level Order Traversal of Binary Tree
©2006~2024 SteakOverCooked - 0.01101 Seconds(s) - 1760.898 KB/s - 8 Online
Memory: 491.86 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />
![](/images/top.jpg)
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !