# Leetcode 227 - Basic calculator II

`Note:`

- Need a
`regex`

to remove spaces from the expression. - Need a
`prev`

to store last operand. - For division and multiplication, we need to update
`prev`

as`prev*cur`

or`prev/cur`

.

`Question:`

Given a string s which represents an expression, evaluate this expression and return its value.

The integer division should truncate toward zero.

You may assume that the given expression is always valid. All intermediate results will be in the range of [-231, 231 - 1].

Note: You are `not allowed`

to use any built-in function which evaluates strings as mathematical expressions, such as eval().

`Example:`

1 | Input: s = " 3+5 / 2 " |

`Code:`

1 | /** |