354. Basic Calculator
HardParsingStack
Evaluate an expression with non-negative integers, + − * /, parentheses and spaces. Division truncates toward zero; * and / bind tighter than + and −.
Input format
A single expression.
Output format
Its value.
Example 1
Input
3+2*2
Output
7
Example 2
Input
3/2
Output
1
Constraints
Length ≤ 10⁴; intermediate values fit in 64 bits.
Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.
Loading the MyLoginn IDE…