DIY: Basic Calculator II
Explore how to implement a basic calculator that parses and evaluates string expressions containing integers and arithmetic operators in Swift. Learn to handle operator precedence, integer division rounding, and produce correct computed results. This lesson helps you develop skills needed for coding interview problems involving expression evaluation.
We'll cover the following...
We'll cover the following...
Problem statement
In this challenge, you are given a string, st, which contains an expression. You’ll evaluate this expression and return its value. Keep the following statements in mind while solving the problem:
- The integer division should be rounded off to the nearest smallest integer.
- The given expression is always valid, giving the intermediate result in the range of -