Tap here to switch tabs
Problem
Submissions

Problem: Basic Calculator III

med
30 min
Try to solve the Basic Calculator III problem.

Statement

Given a string s representing a mathematical expression, evaluate and return its result as an integer.

The expression string contains digits, addition '+', subtraction '-', multiplication '*', division '/', and parentheses '(' and ')'.

Note: The integer division should truncate toward 00.

Constraints:

  • 1≤1 \leq s.length ≤104\leq 10^4

  • s consists of digits, '+', '-', '*', '/', '(', and ')'.

  • s is a valid expression.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Basic Calculator III

med
30 min
Try to solve the Basic Calculator III problem.

Statement

Given a string s representing a mathematical expression, evaluate and return its result as an integer.

The expression string contains digits, addition '+', subtraction '-', multiplication '*', division '/', and parentheses '(' and ')'.

Note: The integer division should truncate toward 00.

Constraints:

  • 1≤1 \leq s.length ≤104\leq 10^4

  • s consists of digits, '+', '-', '*', '/', '(', and ')'.

  • s is a valid expression.