Meta Interview Question

Calculator question on Leetcode. Difficult to finish within 20 mins