bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
HardStackLC 772

Basic Calculator III

Implement a basic calculator to evaluate a simple expression string. The expression string contains only non-negative integers, '+', '-', '', '/' operators, and open '(' and closing parentheses ')'. The integer division should truncate toward zero. You may assume that the given expression is always valid. All intermediate results will be in the range of [-231, 231 - 1].

Asked at 14 companies
AmazonAppleBytedance
Hints
  • 1.Think about which data structure fits best
  • 2.Consider the time complexity of your approach
  • 3.Look for patterns in the constraints
LeetCode