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 | 330 Views, 19891 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 | 330 Views, 19891 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 | 330 Views, 19891 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
- Linode Support Ticket 10029540 - Other - Important Notice Regarding Ubuntu 17.10 Image
- Daily Interview Problem: Given two arrays, write a function to compute their intersection.
- New Vulnerabilities (CVE-2016-4581) have been detected in CentOS/RHEL/CloudLinux 7
- Daily Interview Puzzle: Ways to Traverse a Grid
- Daily Interview Problem: Look and Say Sequence
- Daily Interview Problem: Minimum Removals for Valid Parenthesis
- Design Tic-Tac-Toe
- Maximum In A Stack
- Daily Interview Puzzle: Intersection of Linked Lists
- Palindrome Integers
©2006~2024 SteakOverCooked - 0.02119 Seconds(s) - 2513.347 KB/s - 26 Online
Memory: 530.84 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 !