Basic Calculator
Problem
Given a string
srepresenting a valid expression, implement a basic calculator to evaluate it, and return the result of the evaluation.Note: You are not allowed to use any built-in function which evaluates strings as mathematical expressions, such as
eval().
Example 1:
Input: s = "1 + 1" Output: 2Example 2:
Input: s = " 2-1 + 2 " Output: 3Example 3:
Input: s = "(1+(4+5+2)-3)+(6+8)" Output: 23
Pseudocode
Solution
Time and Space Complexity
Time
What did the code do
Total -
Space
What did the code do
Total -
Last updated