Amazon interview question

Basic Calculator problem from Leetcode