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 | 567 Views, 23729 Search Bots | 61 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, | English | Home Page | Category: Computing | 567 Views, 23729 Search Bots | 61 Words
| Browse | Archive
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 | 567 Views, 23729 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
Related Articles
- Daily Interview Problem: Largest BST in a Binary Tree
- Algorithm Interview Question: Symmetric k-ary Tree
- Number of Ways to Climb Stairs
- ImageMagick Vulnerabilities - CVE-2016–3714
- Daily Interview Problem: First Missing Positive Integer
- Daily Interview Problem: Maximum Profit From Stocks
- Daily Interview Problem: Word Ordering in a Different Alphabetical Order
- Design Tic-Tac-Toe
- Algorithm Interview: No Adjacent Repeating Characters
- Patterns for breaking down questions you haven
©2006~2024 SteakOverCooked - 0.00722 Seconds(s) - 7412.438 KB/s - 39 Online Memory: 527.77 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" />
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Comments (0)
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !