Leet Code Basic Calculator II

I need help in solving Basic Calculator II problem on Leetcode.

1 Like

I couldn’t copy the code … But you can take help from this … I first converted it to postfix and solved it … you can optimize it further


Thanks for sharing, but I have the code for this.

Is there any general programming technique to solve this kind of problems, I want to learn a general way to tackle such expression problems so that I can solve them on my own.

It would be really helpful if you can help me with the programming paradigm under which this problems fall.

Bro … as per to my knowledge you have to solve this type of problem by converting it to either prefix or postfix notation and then evaluate the expression using stack. Because it is harder for computer to solve infix .so this becomes the general technique to solve this type of arithmetic expression. This type of program may fall under the category of stack and queue usage .If you know how to convert a exp to various forms you can solve it . For further details Google ( how to solve arithmetic expression).

1 Like