Your explaining power and clarity of thought is excellent. Keep it up.
@KeertiPurswani
4 жыл бұрын
Thank you :)
@oleksandrasaskia
2 жыл бұрын
Very helpful explanation, really helped to start from the simpler problems and work the logic to the trickiest one! Love the support you are giving to all of us while explaining really hard moments! Thank you SO MUCH for your hard work!! Keep it up!
@Vendettaaaa666
4 жыл бұрын
I have a challenge for you Keerti, almost every solution in the internet talks about solving it iteratively. It doesn't explain how we all arrived at this iterative approach. Iterative approach is the last step in a DP solution. We first start with plain Recursion + Divide and Conquer, then see overlapping problems, then we memoize it, then we see that our problem's state changes on only two variables and we "transform" it into a iterative one. Unfortunately directly explaining the iterative approach is like we need to "memorize" this approach. I am looking for the INTUITION behind it. Thanks for taking the effort in making this video, I have some take aways from it. Looking forward to your response. Thank you, A fan
@KeertiPurswani
4 жыл бұрын
Hi, thanks for your comment! I try to discuss the intuition behind each problem. Please do tell me what exactly did I miss. I would love to take up the challenge. I hope you have gone through the other dp videos as well :) Last thing I want someone to do through my videos is to memoize the solution..
@Vendettaaaa666
4 жыл бұрын
You definitely explained the intuition behind the iterative approach. But the thing is, the iterative approach is a FINAL step in DP optimization. It goes from Top Down (Recursive) ----> Then Memoize overlapping sub-problems ----> Then flip it upside down via bottom UP (Here there is no call stack, it's all iterative) It's hard to explain on KZitem comments, but I hope we are getting somewhere on the same page?
@KeertiPurswani
4 жыл бұрын
Yes I am getting what you are saying but in an interview you don't have so much time. Getting the Intuition and being able to write dp solutions is my core purpose for the series. If many people need it, I will surely make separate videos to cover memoization etc. Can't include in same video as most people prefer shorter videos and my videos are already long. I hope you understand what I am saying..
@KeertiPurswani
4 жыл бұрын
A similar discussion happened on my wildcard matching video :) I am trying to follow approach that will help more number of people. Thank you for your feedback! If there are more people who need this, I will definitely make videos covering it :)
@Vendettaaaa666
4 жыл бұрын
@@KeertiPurswani Thank you Keerti *thumbs up*
@safakhan8177
3 жыл бұрын
Keerti, thank you so much for the best ever explanation! I finally understood the problem and was able to write the code. I have had trouble understanding the dynamic approach for k transactions. I tried various other explanations but I still couldn't figure it out. So glad to have found your channel!
@satyaadityabaratam35
2 жыл бұрын
you might be bored reading this, but its my responsibility to acknowledge the help you did by making a video on this, thank you so much.
@CostaKazistov
2 жыл бұрын
Found best explanation of this LeetCode question - out of all the videos of max K variation, this is by far the clearest.
@sojanmathew5875
3 жыл бұрын
@Keerti, really nice explanation, keep doing more (variant - stock buy/sell with transaction fee). 2 suggestions: - intuitive variable names (arr -> prices, M->profit, 'M' vs 'm' at 16:29 how about 'm'->k to keep it simple) - Please add git repo link for the solution and quick code walk-thru (2-3 min)
@KeertiPurswani
3 жыл бұрын
Will do! Thanks for your suggestion 😊
@sachinmagdum
3 жыл бұрын
Good explanation. In case of 1, 2, 3, 4, 5, 6 the profit of buying at 1 and selling at 6 is highest as we cannot buy and sell on the same day hence scenario of buying at 1 and selling at 2 and again buying at 2 and selling at 3 and so on is invalid. In this case peak and valley makes sense to maximize the profit, 1 is valley and 6 is peak.
@suewang6662
2 жыл бұрын
The best video so far I have seen for Buy and Sell Stock problems. Thank you so much!
@monidipasarkar806
3 жыл бұрын
Thanks Keerti. Done an amazing job here :) Keep this up!
@KeertiPurswani
3 жыл бұрын
Thanks 😇😇
@saurabhsen3560
3 жыл бұрын
I watched all videos on this question but your explanation was the best among them. Keep up the awesome work!. It really helped me. Thank you for taking your time out and teaching us.
@sanyamgirdhar6636
3 жыл бұрын
As simple as it can be, beautiful explanation. The same approach works for all variants. Can you take some more standard hard problems?
@KeertiPurswani
3 жыл бұрын
For sure, many coming up!!
@phanindratube10
Жыл бұрын
Liked the video. Would have been more intuitive if started with explaining the relevance of overlapping sub-prob and optimal sub-structure in this problem. I understand from comment section you are against doing memoization in the interviews but jumping directly to explaining optimised approach has high chance of people memoizing the solution itself :-) and find it hard to arrive at an approach when the question is tweaked in the interview. As with length of the videos, timestamps in the video description may help, if people wants to jump directly to final optimized solution. My dumb brain lost it when you started doing k=2. LOL. But still a great video. Myself a big fan of your catalan numbers video. Thanks for your efforts.
@sidhuparas
3 жыл бұрын
Awesome. One video for all cases is a gold resource. Great explanations :)
@anchalpandey3619
2 жыл бұрын
Omg such a nice explanation :) This video is damn underrated!
@shivanib4723
2 жыл бұрын
Wooah!!! Your explanation was awesome it went right into my head!!!! Thankyou
@prabhatrai6292
4 жыл бұрын
Ye ques maine bohot pehle try kiya tha pr nhi huwa but aaj ek aur try diya but I was'nt able to solve. Finally I got the approch. Thanks for your effort
@KeertiPurswani
4 жыл бұрын
Thank you 🙂
@Adityasingh-ev3dg
3 жыл бұрын
well, at 7:12 you are saying we don't need to check that but that's wrong completely.You use else in place of else if it will be wrong bcoz its not necessary that arr[i]-min>profit always.
@palakmantry
4 жыл бұрын
This helps a lot. A very good compilation.Thanks Keerti!!
@KeertiPurswani
4 жыл бұрын
Thanks Palak 😇
@sajalpushpad
3 жыл бұрын
Great explanation.. Keep posting such amazing video. Thanks a lot
@KeertiPurswani
3 жыл бұрын
Thank you ❤️ Hope you like other videos as well 😇
@hasanalic.n970
3 жыл бұрын
Thanks, a lot keerti, God Bless you. I was struggling to understand this problem from morning to evening I was not getting into my head. Finally, your explanation and way of teaching helped me to understand clearly without any doubts. Thanks a lot once again.
@KeertiPurswani
3 жыл бұрын
So glad I could help you ❤️
@manishchikoti3658
Жыл бұрын
Am I only the one who thinks she could have explained better , well I learnt something so I do not have any regrets seeing this video
@rohitshekharsingh2579
3 жыл бұрын
best video explanation on yt for this problem
@KeertiPurswani
3 жыл бұрын
Thanks Rohit. Hope you like rest of the videos as well 😇
@manu-singh
3 жыл бұрын
I finally got my head around this problem today. All thanks to you Keerti di.
@KeertiPurswani
3 жыл бұрын
Yay 😇😇
@mayankpatel6735
3 жыл бұрын
Didi code bhi daal dete to acha hota !!! I can see a million subscriber you tuber coming up ;)
@pavankalyankolisetty5823
3 жыл бұрын
Just Loved the Explanation, Wanted more tutors like you :)
@KeertiPurswani
3 жыл бұрын
Thank you so much Pavan. Means a lot😇😇
@growandlearndaily
Жыл бұрын
you are really awesome explainer :)
@varuntaneja7073
3 жыл бұрын
Next level explanation .....Hats off!!
@KeertiPurswani
3 жыл бұрын
Thank you so much ❤️
@ThePaullam328
Жыл бұрын
How do you come up with "maxDiff"? How did you derive maxDiff from m -> 0...j - 1?
@tejaspradhan1185
3 жыл бұрын
Really well explained! Thanks a lot!
@KeertiPurswani
3 жыл бұрын
😇😇
@suranjanmondal2349
3 жыл бұрын
Great explanation! Thanks a lot!
@redstarentertainment2621
2 жыл бұрын
This was about finding Maximum Profit. How to find Minimum Loss that the user can have?
@shwetajha8745
3 жыл бұрын
Amazing ✨👏🏻
@ayushprakash3890
3 жыл бұрын
And please make videos for the other two variations as well. It will be really helpfull
@KeertiPurswani
3 жыл бұрын
Sure!!
@raazgreat4159
4 жыл бұрын
Hii @Keerti Purswani thank u for such a beautifull solution with great explaination ........... looking forward for the videos on Best time to Buy and Sell Stock with cool down and with transaction fee . I solved these questions but still many times confuse , I hope i can get some clear clarity with your beautifull way of explaining :)
@RajSingh-dl2lk
3 жыл бұрын
Underrated channel
@KeertiPurswani
3 жыл бұрын
Please do help the channel grow by sharing it with your friends 😊
@arjunkhanna1803
2 жыл бұрын
could not understand why maxDiff approach will work?
@RohitExclusive
3 жыл бұрын
Amazing Explanation. Keep it Up!
@KeertiPurswani
3 жыл бұрын
Thank you 😇😇
@AyushDasMyGooglePage
4 жыл бұрын
Quite enlightening! Can some one please provide this array for the future of any one company.
@tirthjayswal9895
3 жыл бұрын
Really good explenation
@rohanchhabra3343
3 жыл бұрын
Hello Keerti! Is there any way we can apply this optimization (maxDiff) to a recursive solution? I am more into recursive based dynamic programming solutions as I find them much more intuitive and it has paid me dividends! I was finding it difficult to implement this optimization in a recursive solution.
@vishalkumar-bz5mq
4 жыл бұрын
great explanation , keep it up :)
@KeertiPurswani
4 жыл бұрын
Thank you 😊😊
@mandar.vaidya
3 жыл бұрын
Can you also create in Hindi
@venkateshpachigulla
3 жыл бұрын
I know this is a problem but in the real world, it's not possible because no one knows tomorrow's price. 😊
@himanshidixit6406
3 жыл бұрын
Keep going...great explanations..🤗
@KeertiPurswani
3 жыл бұрын
Thank you 😇😇
@arjr678
3 жыл бұрын
GREAT EXPLANATION !!!!!!!!!!!
@KeertiPurswani
3 жыл бұрын
Thank you 😇
@chaitanya5885
3 жыл бұрын
please explain the other two variations mam
@KeertiPurswani
3 жыл бұрын
Noted 😊
@ashutoshmalguri
2 жыл бұрын
They only thing that went into my head is that you are making really good profits in stocks...O(paisa^paisa)
@deepakbhardwaj9543
3 жыл бұрын
good explanation! Thanks!
@KeertiPurswani
3 жыл бұрын
Glad you liked it!😇
@nidhigupta9909
3 жыл бұрын
Wouldn't it be k>=n/2 ??
@HarshitGautam11
3 жыл бұрын
Very nice explanation you covered all the scenario . Also no offense but its sometimes difficult to concentrate between you and the problem.
@coppercu9335
3 жыл бұрын
you are the problem.
@ravitejachittela4370
4 жыл бұрын
Thanks for explanation.I have been going through many videos for this problem.But still I'm struggling for cool down.Can you explain it?
@KeertiPurswani
4 жыл бұрын
Sure, will do 😊
@siwi_drake4703
3 жыл бұрын
I like ur denim..which brand?
@misubgify
3 жыл бұрын
Once again, You should A+ for your explanations
@KeertiPurswani
3 жыл бұрын
Haha thanks 🤭🤭
@stevemiller7050
8 ай бұрын
this question ist so dumb. in the Stockmarket is no Time Machine to see what the price will be in the future. so you just hope to buy low, but you will never ever know if you sell with the highest profit.
@mahipalsingh-yo4jt
3 жыл бұрын
nice explanation !!!!!!!!!!!!!
@KeertiPurswani
3 жыл бұрын
Thanks 🙂
@divyanshutiwari6571
3 жыл бұрын
I think maxdiff should be M[i][m]-v[m] instead of M[i-1][m]-v[m] because former is giving correct answer while later is giving incorrect answer. plz see into it ma'am.
@KeertiPurswani
3 жыл бұрын
Depends on the question you are doing Divyanshu. If you can make buy after selling on the same day, it will be M[I][m]. If you can buy only one day after selling, it's M[I-1][m]
@divyanshutiwari6571
3 жыл бұрын
@@KeertiPurswani okay ma'am got it. Thanx for replying. Your videos are really helpful.
@be_like__prateek
3 жыл бұрын
Rocked !!!
@KeertiPurswani
3 жыл бұрын
Thanks 😇
@techdemy4050
3 жыл бұрын
It was an awesome explanation. But I have one doubt GFG code snippet: profit[t][i] = max(profit[t][i-1], price[i] + max(prevDiff, profit [t-1][i-1] - price[i-1]) where prevDiff is max(profit[t-1][j] - price[j]) for all j in range [0, i-2] This thing I didn't understand, profit [t-1][i-1] - price[i-1]. Can someone clear my doubt like why profit[t-1][i-1] - price[i-1].
@siwi_drake4703
3 жыл бұрын
Abe tujhse kisi ne pucha ki code de faltu ka hero ban raha hai lodu😡😡😡
@techdemy4050
3 жыл бұрын
@@siwi_drake4703 Homie chill, I know your parents might use these words at your home but dont show your culture what your parent's taught you here in social media it gets viral dude.
@desiqna5223
3 жыл бұрын
It's like that , because of the formula , we need max of those values for optimization. Watch video again.
@theuntoldtree
2 жыл бұрын
ig ,i saw her on linkedin O.o
@bishnuagrawal828
3 жыл бұрын
it was helpful :)
@KeertiPurswani
3 жыл бұрын
So glad 😇
@ayushprakash3890
3 жыл бұрын
Are we allowed to buy and sell on the same day?? I mean i bought the stock on day x @ 1 sold it @ day y @ 5 again buy the stock @ 5 and sold it on some day z @ 10 ?? Its like: buy (sell,buy) sell ... We are selling and then buying on the same day.. . is this allowed ... Because the question mentions it is not allowed but ur algorithm allows this... Help me !
@KeertiPurswani
3 жыл бұрын
Hi Ayush, You can buy a stock on the same day after selling it Otherwise it would have been mentioned that there is a cool down of 1 day and you can buy on next day only 😊
@ajaysharma2007ym
3 жыл бұрын
@@KeertiPurswani This doesn't seem right, why we will buy and sell the same day?
@hamsithachallagundla
3 жыл бұрын
@@ajaysharma2007ym sell the previous stock and buy a new stock
@vinaykumardahiya4260
3 жыл бұрын
amazing!
@KeertiPurswani
3 жыл бұрын
Thanks 😇😇
@ravitejachittela4370
4 жыл бұрын
And I wanna ask something. Without knowing the problem from basic like recursion it's waste of learning. It's mostly like byhearting the problem. In interviews we can't explain clearly..My request is to make videos from basic
@KeertiPurswani
4 жыл бұрын
I have been explaining the logics. I hope noone thinks that is anywhere near to "byhearting" the problem. But yes, you are right and I am planning to cover recursion in coming videos 😊 My major worry initially was the length of videos. Already my videos are pretty long and I am sure if I add recursion, many people won't open them because everyone is short of time 😅
@ravitejachittela4370
4 жыл бұрын
@@KeertiPurswani Make the one video into parts and complete topic covers nearly 3-4 problems in leetcode. So it'll be very helpful if we understand from basics
@KeertiPurswani
4 жыл бұрын
@@ravitejachittela4370 this is the only video where I have covered multiple problems. Please checkout other dp problems on my channel as well. Even those videos are pretty long 😅
@ravitejachittela4370
4 жыл бұрын
@@KeertiPurswani okay..your explanation is good. Once again thanks for making videos for us
@KeertiPurswani
4 жыл бұрын
Thank you @raviteja. It really means a lot to me ☺️ and I hope you didn't misunderstand what I was saying. I genuinely want people to understand the questions I do tutorials on 😅
@ganeshannt74
3 жыл бұрын
Opps ... I thought its a stock market tutorial to buy and sell ... 🙄 it's different
@KeertiPurswani
3 жыл бұрын
🤭🤭 In case you want to check out content on stocks, my father has a channel on the same with the name - Kishore Purswani 😇😇
@code7434
4 жыл бұрын
Make variations of stock sell problem vidoes
@KeertiPurswani
4 жыл бұрын
Which variations?
@code7434
4 жыл бұрын
@@KeertiPurswani one with cooldown , it's there on leetcode
@KeertiPurswani
4 жыл бұрын
Yes I have mentioned that in the end of video. One is with cooldown and one with transaction fees :)
Пікірлер: 125