Coding

Evaluate a mathematical expression given as a string.

Given a string representing a mathematical expression, evaluate it and return its value. The expression can contain basic arithmetic operators, and integer division should truncate toward zero.

Input: s = "3+5/2"

Output: 5

Explanation: Following the order of operations (PEMDAS), 5 / 2 = 2 (integer division), and 3 + 2 = 5.

Was asked at

Practice this question with AI

First session is free - no credit card required.

Go Premium

More interviews, more skills, more success.

Community Answers

2 answers from the community

Expert Answer

Unlock Full Access

Answer any un-answered question from our database to unlock all community answers for 30 days.

Give & Take

Unlock Full Access

Answer any un-answered question from our database to unlock all community answers for 30 days.

Give & Take

Practice More Questions