LeetCode 227 Basic Calculator II - Problem Statement

The problem

Evaluate a string containing integers and operators +, -, *, /.

With "3+2*2", the answer is 7. Multiplication happens before addition: 3 + (2*2) = 3 + 4 = 7.

With " 3/2 ", the answer is 1. Division truncates toward zero.

With " 3+5 / 2 ", the answer is 5. Division first: 3 + (5/2) = 3 + 2 = 5.

No parentheses. Spaces may appear anywhere. Division is integer division.

Constraints: 11 \le length 3×105\le 3 \times 10^5. Expression is always valid.