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

Related Articles

  1. Find Missing Numbers in an Array
  2. Daily Interview Problem: Decode String
  3. [Daily Problem] Remove Consecutive Nodes that Sum to 0
  4. Making a Height Balanced Binary Search Tree
  5. Daily Interview Problem: Find the k-th Largest Element in a List
  6. Algorithm Interview: String Compression
  7. Daily Interview Question: Find Cycles in a Graph
  8. Skip the readings, focus on problems. And use all the hints!
  9. Compare Version Numbers
  10. [Daily Problem] Course Prerequisites

Comments (0)

Your Email (Domain Part Not Exposed):

Your Comments:

Privately By Mail Colors More Smileys S x y @

Verification (Click Image 2 Refresh):

    Be the first one to comment this page !


Page Edited: October 30 2020 14:21:09 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />