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

Related Articles

  1. Palindrome Integers
  2. Non-decreasing Array with Single Modification
  3. Daily Interview Problem: Largest Product of 3 Elements I
  4. Algorithm Interview: Maximum Path Sum in Binary Tree
  5. Progess made
  6. Design Tic-Tac-Toe
  7. [Daily Problem] Add two numbers as a linked list
  8. Daily Interview Problem: First Missing Positive Integer
  9. Print a tree level-by-level, with line-breaks
  10. Two-Sum

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">