[Java] Leetcode 227. Basic Calculator II [Stack & Queue #8]

preview_player
Показать описание
In this video, I'm going to show you how to solve Leetcode 227. Basic Calculator II which is related to Stack & Queue.

Here’s a quick rundown of what you’re about to learn:

⭐️ Course Contents ⭐️
⌨️ (0:00) Question
⌨️ (2:29) Solution Explain
⌨️ (6:21) Code

In the end, you’ll have a really good understanding on how to solve Leetcode 227. Basic Calculator II and questions that are similar to this Stack & Queue.

Рекомендации по теме
Комментарии
Автор

what if you have something like 2+3*5/2. If it is all an integer it will give you different results on / and * (depending on which you'll do first)

sampannapokhrel
Автор

Great video! I was stuck on this problem and your approach helped me solve it. Thanks!

mooneyross
Автор

Hey! thank you so much for the code, but can you tell me, how can i push and pop the decimal(.) in the stack.. if i have decimal values in my arithmetic string. Or how can I append the Dot(.) with suppose I have decimal value 2.5 so I want to append the Dot with 2 and push it on to the stack like this (2.) can you help me with this

amitkhatri
Автор

It's rare to see Leetcode solutions having instance variables and in your example you should ideally reset index = 0 at the beginning so that when testing you can call calculate multiple times for a given instance.

rydmerlin
welcome to shbcf.ru