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 | 324 Views, 19831 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 | 324 Views, 19831 Search Bots | 61 Words Subscribe to Feed Burner

Related Articles

  1. Fix Brackets
  2. First and Last Indices of an Element in a Sorted Array
  3. Fibonacci coding
  4. Daily Interview Problem: Running Median
  5. Daily Interview Problem: Sort Colors
  6. Top K Frequent words
  7. Skip the readings, focus on problems. And use all the hints!
  8. Delphi Dynamic Array
  9. Daily Interview Question: Longest Sequence with Two Unique Numbers
  10. Longest Substring Without Repeating Characters

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="noindex, follow" />