Evaluate a Calculator / Expression

Problem Implement a calculator that evaluates a string arithmetic expression with +, -, *, / and parentheses, respecting operator precedence.

Input / Output

  • Input: a string expression (e.g. "3+2*2").
  • Output: the evaluated integer result (integer division truncates toward zero).

Constraints

  • The expression is valid; integer division truncates.
  • Handle nested parentheses and precedence (*// bind tighter than +/-).

Example

  • "3+2*2" → 7.
  • "(1+(4+5+2)-3)+(6+8)" → 23.
added …
LeaderboardSalaryAccount