To the Top
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 | 301 Views, 19347 Search Bots | 61 Words

Subscribe to Feed Burner | 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:


def eval(expression):
# Fill this in.

print eval('- (3 + ( 2 - 1 ) )')
# -4
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, | English | Home Page | Cateogry: Computing | 301 Views, 19347 Search Bots | 61 Words Subscribe to Feed Burner

Related Articles

  1. Daily Interview Problem: Product of Array Except Self
  2. Algorithm Interview Question: Find the Single Element in an Array of Duplicates
  3. Daily Interview Problem:Create a balanced binary search tree
  4. Daily Interview Problem: Full Binary Tree
  5. Maximum In A Stack
  6. Daily Interview Problem: Contiguous Subarray with Maximum Sum
  7. Algorithm Interview Question: Nth Fibonacci Number
  8. Daily Interview Problem: Decode String
  9. [Daily Problem] Witness of The Tall People
  10. Daily Interview Problem: Jump to the End

Comments (0)

    Be the first one to comment this page !


Page Edited: May 11 2024 14:36:49 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="index, follow">