Medium · Math
Basic Calculator II
Given a string s holding a valid expression of non-negative integers, '+', '-', '*', '/' and spaces (no parentheses), return its value; integer division truncates toward zero.
Examples
Example 1
{
"s": "3+2*2"
}Output: = 7
Example 2
{
"s": " 3/2 "
}Output: = 1
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.