Best Time to Buy and Sell Stock III | Leet code 123 | Theory explained + Python code

  Рет қаралды 7,969

Sai Anish Malla

Sai Anish Malla

Күн бұрын

Пікірлер: 15
@philipmenke7741
@philipmenke7741 3 жыл бұрын
Much clearer explanation then the solutions leetcode has written up, thank you!
@olegkovtun5011
@olegkovtun5011 Жыл бұрын
Thanks man, it is very instructive!
@tvsnath
@tvsnath 18 күн бұрын
Much clear explanation. thank you.
@nands4410
@nands4410 4 жыл бұрын
8:05 why do you take max? We want to buy the lowest price right
@saianishmalla2646
@saianishmalla2646 4 жыл бұрын
Yeah so you need to understand that the value is actually referring to the profit like you said we want the lowest price. When you buy your profit decreases which is why we choose the value where we lose less of our profit.
@ParthPatel-ji1up
@ParthPatel-ji1up 2 жыл бұрын
@@saianishmalla2646 @nands , i think a better word instead of profit there is balance. when we buy, our balance becomes less. which we want to buy with whatever that makes the balance the highest (decrease by the least).
@vaibhavagarwal9099
@vaibhavagarwal9099 4 жыл бұрын
Wooow !!! I saw your channel for the first time today🥺 and your content is unbelievable 😍
@saianishmalla2646
@saianishmalla2646 4 жыл бұрын
Hahahaha thanks Vaibhav 😂😂
@mikasaackerman2694
@mikasaackerman2694 3 жыл бұрын
Great Explanation! Would you also make a video of Buy and Sell Stock where the transactions are generalized to k?
@Greatasfather
@Greatasfather 3 жыл бұрын
Hey what do you do for variable number of transactions
@jeneyify
@jeneyify 3 жыл бұрын
I have been following you as I have started leet coding. Amazing explanation, but how do we reach that level where we're able to think of such solution without any help
@parthpatel8532
@parthpatel8532 2 жыл бұрын
You can reach that level by 2 ways. 1. Keep trying and trying until you get an answer. This is the bad way. You'll waste alot of time. 2. When you cant solve a problem in 2 days, come to youtube or something and search for the solution. Learn how the solution is created including patterns used. And in the future when a similar problem arises, you'll know how to solve it. The goal isnt to solve all by yourself. The goal is to learn the patterns and where to use each one!
@TheonlyKT1225
@TheonlyKT1225 6 ай бұрын
Next level broo
@debashishmahato4591
@debashishmahato4591 11 ай бұрын
Beats 99.98% of users 🔥
@42611628
@42611628 3 жыл бұрын
The part that I find a little hard to wrap my head around is we're doing two transactions in a single iteration, unless I work it out, I probably don't think that part is all that intuitive, not saying the solution is the problem, my understanding is the problem :)
Wednesday VS Enid: Who is The Best Mommy? #shorts
0:14
Troom Oki Toki
Рет қаралды 50 МЛН
$1 vs $500,000 Plane Ticket!
12:20
MrBeast
Рет қаралды 122 МЛН
Poor Pigs | Leet code 458 | Theory explained + Python code
21:16
Sai Anish Malla
Рет қаралды 8 М.
DP 37. Buy and Sell Stocks III | Recursion to Space Optimisation
31:50
take U forward
Рет қаралды 186 М.
Best time to buy and sell stock with cooldown | Leetcode #309
34:31
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 780 М.