Solving Basic Calculator in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.

Problem Description

Implement a basic calculator to evaluate a simple expression string.

Example 1:

Input: "1 + 1"
Output: 2

Example 2:

Input: " 2-1 + 2 "
Output: 3

Example 3:

Input: "(1+(4+5+2)-3)+(6+8)"
Output: 23


  • You may assume that the given expression is always valid.

See the full details of the problem Basic Calculator at LeetCode

Originally posted at: