Evaluate a valid expression containing non-negative integers, +, -, (, ) and spaces, and return its integer value.
+
-
(
)
You must not use eval.
eval
s = "1 + 1"
2
s = " 2-1 + 2 "
3
1 <= s.length <= 3 * 10^5 The expression is always valid.
Topics
Implement calculate in the editor and return the answer — printing it is never graded.
calculate
Problem 109 of 1146 in the arena