Solution: Basic Calculator
Let's solve the Basic Calculator problem using the Stacks pattern.
Statement
Given a string containing an arithmetic expression, implement a basic calculator that evaluates the expression string. The expression string can contain integer numeric values and should be able to handle the “+” and “-” operators, as well as “()” parentheses.
Constraints:
Let s
be the expression string. We can assume the following constraints:
-
s.length
Access this course and 1400+ top-rated courses and projects.