Mini Calculator (No eval)

JavaScript Medium 2 views
Back to Questions

Problem Description

Given an expression with + - * / and non-negative integers, compute the result using correct precedence (* and / first). Integer division should floor.

Input Format

One line expression, may have spaces.

Output Format

One integer result.

Sample Test Case

Input:
10 + 2 * 3 - 4 / 2
Output:
14

Constraints

Expression is valid, numbers fit in 64-bit.

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next