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
Open every published interview problem, solution, scene, and memory room free, with no account.