Difficulty: Hard | Category: Stack | Asked at: Google | Platform: Unfoldd Arena
Solve Basic Calculator online for free in Python, JavaScript, Java, C++, TypeScript, Go, Rust, PHP, Swift, Kotlin, Dart, Ruby, C, and C#. Practice Hard level coding interview problems with instant test case evaluation and AI-powered analysis.
Keywords: Basic Calculator solution, Basic Calculator leetcode, Basic Calculator python, Basic Calculator javascript,Basic Calculator java, Basic Calculator approach, how to solve Basic Calculator, hard coding problems, Stack problems, coding interview preparation, DSA practice free.
Given a string
sThe valid operators in the expression are
+-*/Your function should support non-negative integers and decimal numbers.
s+-*/+-*/s+-ssYour function should return the result of the mathematical expression as a number. The result may be a decimal number if the input expression contains decimal points.
Input: {"s":"1 + 1"} Output: 2
Solve problems, verify your skills, and earn XP.