Leetcode 0224. Basic Calculator

Posted on Sun 20 November 2022 in Leetcode • Tagged with calculator, parentheses

Question Link : https://leetcode.com/problems/basic-calculator/

Difficulty: Hard

Question

Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result of the evaluation. Note: You are not allowed to use any built-in function which evaluates strings as mathematical expressions, such as …


Continue reading

Leetcode 0227. Basic Calculator II

Posted on Sun 20 November 2022 in Leetcode • Tagged with calculator

Question Link : https://leetcode.com/problems/basic-calculator-ii/

Difficulty: Medium

Question

Given a string s which represents an expression, evaluate this expression and return its value.  The integer division should truncate toward zero. You may assume that the given expression is always valid. All intermediate results will be in the range …


Continue reading