# 124. calculate arithmetic expression

Share

medium - accepted / - tried

In 119. create a tokenizer, you are able to extract the tokens from a string with invalid spaces.

Now please `calculate()`

the result of the string. You can use the tokenizer you wrote before.

`calculate('1 * (20 - 300 ) ')// -280calculate(' 1/0 ')// Infinity`

- the input expression is syntactically valid, containing non-negative integers,
`+`

,`-`

,`*`

,`/`

,`(`

,`)`

and spaces - Don't use
`eval()`