"I finally found the best explanation on TH-cam after watching several videos, as none of the others were able to provide me with such clear and thorough understanding as this one did." Thanks for this😊😊
Respected MIK Sir, I wish TH-cam would have allowed me to like this video multiple times. Such a clear and simple explanation. Thank you so much, Sir. 🙏🙇
Although I've studied my entire dp from striver, but the only person in youtube who explains equally good to him is u.. But one suggestion, plz try taking at least 1 test case for sample run.. ❤❤❤
Thank you so much. Your comment made my day. And definitely i will work on the suggestion you have given. Thank you once again for your precious feedback ❤️❤️❤️
@vaibhav454 hello there, Kindly try my “DP Concepts & Qns” playlist where I teach recur+memo as well as bottom up 😇🙏♥️ th-cam.com/play/PLpIkg8OmuX-JhFpkhgrAwZRtukO0SkwAt.html&si=eGXOTIfFJx2fQ9W- More coming soon in that playlist ♥️
@@codestorywithMIK No doubt, u explains better than striver, babbar but try to discuss bottom up as well as space optimized approaches for all dp ques...
hi i thankyou ...firstly ur explanation is excellent..secondly i am able to solve questions without referring to youtube like if any person solved or not..thirdly ur explanation touch core logic ...thankyou sooooo much😄😄😄
Bro good explanation but one request from my side is to dry run for atleast one example case. So it clears lot of things like how the recursion is working. And also recursion tree. Earlier I told you abt this. no problem if the video goes for long. Thanks
Bro can you make video on stone game 1 too. The explanation of that question is conflicting with this one (i watched someone else video), like his explanation was when you have choise chose best , but expect the worse which made sense to me as other player is playing optimally .
The explanation is really soo good. But I've a request when you explain pls cover the left over topics too. just in this q you explain all the things in a minority details which is really appreciable but when you use dp for memorization you just write the code which is fine but person like me who don't really understand dp well this seems a bit confusing. p.s: tho I watch 38 min but u caught my attention such a way that after finishing it seems to me like 5 min
Today’s upload will be a little delayed because I am travelling. But I have provided the link of my GitHub code (exact copy of LCS code pattern) in my post in TH-cam Thank you 🙏😇
so stones can be picked from the first piles only, it can not be like that, Alince can pick the pile having max stone.. I see there are 9 questions int the series, u have covered 3rd also, I will try those once I start from scratch again, rn I just focus on daily potd and solutions...
Hlo MIK Sir really enjoyed this video even my sir leave this question due to tricky statement BUT I request you also to derive problem by Recursion Tree Of any recursive problem that would be easy and for Interview. #RecursionTree
If you notice, We are never considering the stones taken by Bob to find result. The stones is stored in stones variable and it contributes to result only in if(Person == Alice) Now, in the question its mentioned that M gets updated after every pick (say x) by value max (M, x)
Bhai I know you are already working on DP playlist but if possible please try to complete the graph concepts series as well soon. I think just 5-6 topics are left then it will be completed. Sorry for putting you through this ❤💙♥
answer to rat gaya mughe, but abhi bhi ek doubt hai if we are picking the min for bob, then how is that an optimal play, wouldn't bob want to pick max as well .. and bob mai kyun stone add nahi hua wo bhi nahi clear hua please clear this doubt,
The idea goes both ways. We are trying to focus on Alice by exploring all ways, the similar could have been done by Bob too if we focused on him. It's about whose POV you are focusing to solve We are trying to find how many Alice can take, why should we add what Bob took
The time complexity of this code is : O(N*N) because we the for loop can iterate M times and in the worst case it can be equal or close to N. And for each turn the overall calls can make is N hence O(N*N) Right mik bro?
Hi Aryan, Actually this is Optimal Game Strategy. Since the function is written to return Alices score, so when it’s turn of Bob, Alice will expect worst from Bob and hence minimum from Bob is chosen. This is actually a Optimal Game Strategy qn and I will be teaching more on this topic and will be solving more qns on this in my DP Concepts and Qns playlist for sure.
@@codestorywithMIK oh thanks bhaiya , now i understand after some time 😅 and one more request bhaiya , in next questions can yo do dry run of code with one of the example of recursion like how recursion work in these type of questions this will clear all doughts of questions it only take 5-10 min but it is very useful for us
I usually create two playlists for every topic : 1) Concepts Playlist - Contains from basic concepts to expert concepts. 2) Popular Interview Problems playlist. I have created concepts and interview problems playlist for 1) Graph 2) Recursion 3) DP 4) Segment Tree Planning soon to create concepts playlist for Tree as well. Graph Concepts - th-cam.com/play/PLpIkg8OmuX-LZB9jYzbbZchk277H5CbdY.html&si=lZG2IJTmSW4kRrx- Graph Popular Interview Problems - th-cam.com/play/PLpIkg8OmuX-I_49pdy1XFY6OcATnxUrrO.html&si=CG2JvGWVmvoSqvWA Recursion Concepts - th-cam.com/play/PLpIkg8OmuX-IBcXsfITH5ql0Lqci1MYPM.html&si=614iI4NyHY-FTeJH Recursion Problems (In progress) - th-cam.com/play/PLpIkg8OmuX-IXOgDP_YYiJFqfCFKFBDkO.html&si=88fBhRnr62OYTnDP DP Concepts (In progress) - th-cam.com/play/PLpIkg8OmuX-JhFpkhgrAwZRtukO0SkwAt.html&si=laFVYy6ep2BkOg0s DP Popular interview problems - th-cam.com/play/PLpIkg8OmuX-L_QqcKB5abYynQbonaNcq3.html&si=VHEn9b-wqTnAVyyi Segment Tree Concepts - th-cam.com/play/PLpIkg8OmuX-K1qUIQToCllUO0UIKXt8dB.html&si=xm7DqRN4H0eZwna4
"I finally found the best explanation on TH-cam after watching several videos, as none of the others were able to provide me with such clear and thorough understanding as this one did."
Thanks for this😊😊
Thank you so much ❤️❤️❤️
After wasting 3 hour's finally I made them worth by watching this video. Thanks
🙏🙏❤️❤️
Respected MIK Sir,
I wish TH-cam would have allowed me to like this video multiple times.
Such a clear and simple explanation.
Thank you so much, Sir. 🙏🙇
bro i wonder how did u gain this much of knowledge and be able to teach in this way...i really salute to ur efforts and dedication
Although I've studied my entire dp from striver, but the only person in youtube who explains equally good to him is u..
But one suggestion, plz try taking at least 1 test case for sample run.. ❤❤❤
Thank you so much.
Your comment made my day.
And definitely i will work on the suggestion you have given.
Thank you once again for your precious feedback ❤️❤️❤️
Striver sidha bottom up k ratte marwata hai, mik bhai bottom up krate hi nhi
@vaibhav454 hello there,
Kindly try my “DP Concepts & Qns” playlist where I teach recur+memo as well as bottom up 😇🙏♥️
th-cam.com/play/PLpIkg8OmuX-JhFpkhgrAwZRtukO0SkwAt.html&si=eGXOTIfFJx2fQ9W-
More coming soon in that playlist ♥️
@@codestorywithMIK No doubt, u explains better than striver, babbar but try to discuss bottom up as well as space optimized approaches for all dp ques...
one of the finest explanations for this problem.
You are so good🎉❤
Ur work is Admirable🤗
Thank you so much ❤️❤️❤️
hi i thankyou ...firstly ur explanation is excellent..secondly i am able to solve questions without referring to youtube like if any person solved or not..thirdly ur explanation touch core logic ...thankyou sooooo much😄😄😄
Means a lot. 🙏❤️🙏
Bro good explanation but one request from my side is to dry run for atleast one example case. So it clears lot of things like how the recursion is working. And also recursion tree. Earlier I told you abt this. no problem if the video goes for long. Thanks
Sure thing Uday. Noted ❤️❤️
@@codestorywithMIK 💙
Waoo!🤗 learn new technique.
Thanks a lot for watching Vineet ❤️❤️
Best solution available on youtube .🤩
Thanks a lot Alok ❤️❤️❤️
Great knowledge
Legend ho aap 🫡
best explanation and solution for this question is found in this video
Very good explaination..thank you!
Loved your explanation ♥
Thanks a lot 💝
One of the finest explanations.
bhai maja aagya nya concept smj ke
LEGEND is here 🔥
Best explanation
Bhai... "Game Strategy" ki bhi ek playlist bana do na plz
Bro can you make video on stone game 1 too.
The explanation of that question is conflicting with this one (i watched someone else video),
like his explanation was when you have choise chose best , but expect the worse
which made sense to me as other player is playing optimally .
The explanation is really soo good. But I've a request when you explain pls cover the left over topics too. just in this q you explain all the things in a minority details which is really appreciable but when you use dp for memorization you just write the code which is fine but person like me who don't really understand dp well this seems a bit confusing.
p.s: tho I watch 38 min but u caught my attention such a way that after finishing it seems to me like 5 min
Bro keep on posting videos , u will rise soon ✨
Sure thing.
Thank you 🙏😇
Today’s upload will be a little delayed because I am travelling. But I have provided the link of my GitHub code (exact copy of LCS code pattern) in my post in TH-cam
Thank you 🙏😇
@@codestorywithMIK yes bro...one day you will reach one million soon...btw hatsoff to your dedication bro...
13:27 and I just changed 1 Line of my code ---> accepted !!!
Bro can you explain recursion tree for the above problem
@MIK playlist kab aye gi?
Bhai minimum wala concept pls btado ..and aese he tutorials dia kro ap
Sure thing.
It will come in my DP concepts playlist where I will teach Game Strategy
Thanks a lot for watching ❤️❤️
and now we can say we have our own Neet code
so stones can be picked from the first piles only, it can not be like that, Alince can pick the pile having max stone..
I see there are 9 questions int the series, u have covered 3rd also,
I will try those once I start from scratch again,
rn I just focus on daily potd and solutions...
you are legend sir
It means a lot 😇🙏
Please also explain MinMax Algorithm ❤
Sure thing. Planning to add this topic in my DP concepts playlist
Hlo MIK Sir really enjoyed this video even my sir leave this question due to tricky statement BUT I request you also to derive problem by Recursion Tree Of any recursive problem that would be easy and for Interview. #RecursionTree
Sure thing Saquib. Noted
Will take care of this for sure ❤️
NICE SUPER EXCELLENT MOTIVATED
Why do we not need to add stones for Bob?
Also why Math.max(M,x)
Isn't x the place where we are currently in piles?
If you notice, We are never considering the stones taken by Bob to find result.
The stones is stored in stones variable and it contributes to result only in if(Person == Alice)
Now, in the question its mentioned that M gets updated after every pick (say x) by value max (M, x)
But if the stones by Bob are not getting considered, what are we updating the result variable with?
Then, we fetch result from next solve call for Alice
result = min(result, solve(Alice))
@@codestorywithMIK ohhhh got it thank you very much!
Thank you so much. I am glad it helped
saviour thank you
Thank you so much for watching 🙏❤️😇
bhaiya GameStratergy ka playlist nahi mil raha hai can you share if possible(Checked your channel too)
I have not yet created playlist for game strategy. Will soon plan that ❤️🙏
Bhai I know you are already working on DP playlist but if possible please try to complete the graph concepts series as well soon. I think just 5-6 topics are left then it will be completed. Sorry for putting you through this ❤💙♥
No worries Abhijeet.
I am planning to upload videos on both this weekend. Dont worry both will come
❤️❤️❤️
@@codestorywithMIK Thank you so much bhai 😍❤❤
bhaiya ek dry run hojata example se to better smjhta, min wala case bahot confuse kr rha
Legend ❤
thanks for this !!!
🔥🔥best
Thanks a lot Keerti
And the space is O(N) Right as maximum stack depth can go to N ONLY.
Right bro?
amazing
Thanks a lot Sneha
bhaiya stone games ke sare version par similar videos bna do please
Sure thing Keerti
answer to rat gaya mughe, but abhi bhi ek doubt hai
if we are picking the min for bob, then how is that an optimal play, wouldn't bob want to pick max as well ..
and bob mai kyun stone add nahi hua wo bhi nahi clear hua
please clear this doubt,
I think min for bob means minimum bob is expecting alice to take. As we're solving for alice, so for Bob alice should have minimum hence.
The idea goes both ways. We are trying to focus on Alice by exploring all ways, the similar could have been done by Bob too if we focused on him. It's about whose POV you are focusing to solve
We are trying to find how many Alice can take, why should we add what Bob took
Thanks bhai ❤❤
best explaination
Thanks a lot ❤️
The time complexity of this code is : O(N*N) because we the for loop can iterate M times and in the worst case it can be equal or close to N. And for each turn the overall calls can make is N hence O(N*N) Right mik bro?
This T. C & S. C is after excluding the memoization
did not understand why you wrote minimum (was expecting an explaination on this imp part)
I think it's because as we are solving for alice so bob expects alice to get minimum hence.
Bhaiya did not get the logic behind why we do min in case of bob ............
Hi Aryan,
Actually this is Optimal Game Strategy.
Since the function is written to return Alices score, so when it’s turn of Bob, Alice will expect worst from Bob and hence minimum from Bob is chosen.
This is actually a Optimal Game Strategy qn and I will be teaching more on this topic and will be solving more qns on this in my DP Concepts and Qns playlist for sure.
@@codestorywithMIK oh thanks bhaiya , now i understand after some time 😅 and one more request bhaiya , in next questions can yo do dry run of code with one of the example of recursion like how recursion work in these type of questions this will clear all doughts of questions it only take 5-10 min but it is very useful for us
Sure thing Aryan. Noted ❤️❤️❤️
In second case why Alice is not getting answer of 110
Because both play optimal bob also try to maximize our answer
Thank you bhai ❤💙 Java:
class Solution {
private int n;
private int[][][] t;
private int solve(int[] piles, int person, int i, int M) {
if(i>=n) return 0;
if(t[person][i][M] != -1)
return t[person][i][M];
int result = person==1 ? -1 : Integer.MAX_VALUE;
int stones = 0;
for(int x=1; x
❤️❤️❤️
❤
Could you please send me your dp playlist link
I usually create two playlists for every topic :
1) Concepts Playlist - Contains from basic concepts to expert concepts.
2) Popular Interview Problems playlist.
I have created concepts and interview problems playlist for
1) Graph
2) Recursion
3) DP
4) Segment Tree
Planning soon to create concepts playlist for Tree as well.
Graph Concepts - th-cam.com/play/PLpIkg8OmuX-LZB9jYzbbZchk277H5CbdY.html&si=lZG2IJTmSW4kRrx-
Graph Popular Interview Problems - th-cam.com/play/PLpIkg8OmuX-I_49pdy1XFY6OcATnxUrrO.html&si=CG2JvGWVmvoSqvWA
Recursion Concepts - th-cam.com/play/PLpIkg8OmuX-IBcXsfITH5ql0Lqci1MYPM.html&si=614iI4NyHY-FTeJH
Recursion Problems (In progress) - th-cam.com/play/PLpIkg8OmuX-IXOgDP_YYiJFqfCFKFBDkO.html&si=88fBhRnr62OYTnDP
DP Concepts (In progress) - th-cam.com/play/PLpIkg8OmuX-JhFpkhgrAwZRtukO0SkwAt.html&si=laFVYy6ep2BkOg0s
DP Popular interview problems - th-cam.com/play/PLpIkg8OmuX-L_QqcKB5abYynQbonaNcq3.html&si=VHEn9b-wqTnAVyyi
Segment Tree Concepts -
th-cam.com/play/PLpIkg8OmuX-K1qUIQToCllUO0UIKXt8dB.html&si=xm7DqRN4H0eZwna4
@@codestorywithMIK thank you 🙂
Can you tell me what is problem in this code
int solve(int index, vector &piles, int n, int M, int person)
{
cout
loop me min dal na
❤