Correction: In the Recursion + Memoisation approach, we are TLE due to not changing the function call os solveRec to solveMem in "solveMem" function, change that to get rid of TLE.
@vedprakash36212 жыл бұрын
Atleast someone is here to help and correct us. Thank you bhaiya
@pranavdamedhar53752 жыл бұрын
yes bhaiiya ..ek request this bas dp ke liye aap thoda jyada page pe samjhane ka try kro n...drct code krne se samjh nhi ata easily
@iamsuryakant2 жыл бұрын
In solveMem function.. you return mini. it should be return dp[x].
@ayushraj65252 жыл бұрын
@@iamsuryakant Exactly!
@TechCluesByAbsek2 жыл бұрын
Dear bhaiya, your all videos are awesome, **** humble feedback what I felt**** >> feel nhii aaya to convert recursive to bottom-up, it needs more explanation.(what I feel). everything else is top class.
@akshayiyer20142 жыл бұрын
This series is very helpful in understanding dynamic programming. Last month i gave close to 40+ interviews and saw product based companies like Walmart, DP World, Zoomcar, Swiggy, MMT and some startups asking DP or heap related questions. LeetCode and your channel has helped a lot in brushing my dsa skills.
@keshavgupta3832 жыл бұрын
last 2 dp series lecture was amazing but this lecture had some problem in understanding if you could dry run that part would be grateful
@TechCluesByAbsek2 жыл бұрын
Dear bhaiya, your all videos are awesome, ** humble feedback what I felt** >> feel nhii aaya to convert recursive to bottom-up, it needs more explanation.(what I feel). everything else is top class.
@laxmankumawat67282 жыл бұрын
Dry run karke pura bta dete hai tab maaza aata hai Base case jab rich ho jata hai toh badh me call kaise uper aati hai include all questions this make this series more best
@sourabhshubham29102 жыл бұрын
Aap jis tareeke se padha rhe ho na utna hi kaafi hai, multiple approach , aur padhaane ka tareeka , brilliant hai, Thanks a lot for this series :)
@kungagyaltsenlachungpa89152 жыл бұрын
last 2 dp series lecture was amazing but this lectur had some problem in understanding the mimimum coin flow if you could dry run that part would be grateful.Apart from that dp series blockbuster ha.
@codexamofficial2 жыл бұрын
Memorization solves - 14:42 Mistake one - call solveMem function line 32 2nd Mistake pass dp line 32 .... thanks for making this great playlist int solveMem(vector &num , int x , vector&dp) { // Base Case if(x == 0) return 0; if(x < 0) return INT_MAX; // dp case if(dp[x] != -1) return dp[x]; // Recursive case int mini = INT_MAX; for(int i = 0; i < num.size(); ++i) { int ans = solveMem(num , x-num[i] , dp); if(ans != INT_MAX) mini = min(mini , ans+1); } // Recrence Reletion dp[x] = mini; return mini; } int minimumElements(vector &num, int x) { vectordp(x+1 , -1); int ans = solveMem(num , x , dp); if(ans == INT_MAX) return -1; else return ans; }
@naveenshukla35172 жыл бұрын
bhaiya out of above 104 lectures, this was the first lecture, jisme acche se smjh ni aya
@Kinggaming-hp3qp2 жыл бұрын
guruji ko bhut bhut pyar and dil se aabhar.
@itspurelypassionate2 жыл бұрын
for people who didn't understand tabulation method: i = coin number increasing form 1 to x. X is a target sum. num[j] gives coin value. Suppose that i = 2 and num[j] is also 2 then i - num[j] is zero. that means that we should add 1 to the amount of coins needed to get sum 0. We know that 0 coins are needed so (1 + 0) is 1 and minimum of dp[i] = min(dp[i], 1). if previously dp[i] value was MAX_VALUE than dp[2] will become 1. That means to get sum of 2 we need only 1 coin. Now iterate this through all the coins. U will get to know that 1 is the only correct answer (given 2 is present in "num" array. This is just an example. Feel free to ask any doubts)
@Nitian_Trader07 Жыл бұрын
Bhaiya top down approach mai -> [14:47] yahan line no. 33 mai agar ans = INT_MAX aaya to wo if mai nahi jayega or direct mini jo ki INT_MAX hai wo return karega previous called function ko . To pichle function ko int_max hi milte rahega har baar kyuki minimum nikal hi nahi payega kyuki wo line no. 33 ke if condition ke karan . Koi to ho jo ise aache se samjhe pls bhaiyaa make correct that question for upcoming students.
@vishwamshourya33542 жыл бұрын
sir if u will dry and run the code from the following problems, then it will be more helpful, facing a few problems in understanding the memoization approach of this problem..otherwise everything is perfect.
@luckydewangan5985 Жыл бұрын
Recursion+memoization vala approach is giving TLE because in solveMem fxn, the recursive relation is calling solveRec instead of solveMem. So effectively recursion+memoization+recursion ki khichdi ban ja rahi hai.😁😁
@tanayabiswas2417 Жыл бұрын
exactly, i saw that as well
@therealartist98 ай бұрын
bhai gend fatke char ho gyi lekin samajh ni aya
@inter39885 ай бұрын
@@therealartist9 kya nahi aya?
@keshavarya59992 жыл бұрын
Best content on YT......Desi style
@NxNinjae2 жыл бұрын
In your solveMemo function by mistake you used solveRec function that's why it is given TLE
@chandrabhanbahetwar96382 жыл бұрын
This is one of the best dsa series in the you tube
@shreyashdubey59892 жыл бұрын
Bhaiya Mauj Krdia, Lecture Completed !!! Great Explanation❤❤
@B-NikhilRichhariya11 ай бұрын
bohot achha lect tha bhaiya , is baar bhi poore code khud se ban gaye
@rohitrohra7553 Жыл бұрын
aapse seekh ke aza aata hai . Ekdum ghar jaisa
@RahulKumar-wt9qc2 жыл бұрын
Jabardast explanation tha video me bhaiya
@rachit_joshi4 ай бұрын
Thank You So Much BHRATA SHREE !!!!!!!
@yashzawar79382 жыл бұрын
took time to understood the solution but got it at the end as i tried to solve on my own with this logic
@tejalgarud77956 ай бұрын
One of the best learning platform, Thank You Bhaiyya!!
@abhasatin73002 жыл бұрын
thanks bhaiya..after doing a dry run i was able to understand better. i wish the code explanation part came before running the code or while writing the code, easier to understand
@aaravkumar13082 жыл бұрын
bhaiya sab badiya chal rha hai .. U are making the best series .. Keep it up >>
@harishkumar21072 жыл бұрын
What a consistent bhaiya you are best when it comes to coding 🔥🔥❣️❣️🤩
@yashh744911 ай бұрын
Samajh aagya, aur maza bhi aagya ❤
@devangmishra45062 жыл бұрын
gazzab ka lecture ...bhaiya opp
@haiderali08012 жыл бұрын
concept++ , bhaiya.
@anujonthemove Жыл бұрын
Explanation for recursive solution: Out of all possible combinations of the coins(which is what can be seen by the recursion tree), we have to find that 1 combination that makes up to the given amount using minimum number of coins. We are creating the variable `mini` which is initialized with max value, now it is getting updated every time during the recursion when it's previous value is more than the current value. Great explanation except for the glitch in the memoization part. Ek hi baat bolna hai: bhai samajh to acche se hindi me hi aata hai 😝
@ellis-pr7hh Жыл бұрын
Last line is TRUE
@awesomepatt6202 жыл бұрын
Amazing concept bhaiya 🤩🤩
@anupamyadavnit75122 жыл бұрын
Thanks for this wonder full lectures 👍
@namyajain5927 Жыл бұрын
Can someone please explain why are we taking vectordp(x+1,INT_MAX ) in tabulation solution?
@Singh_Sahdev11 ай бұрын
Bro let you took -1 in dp array, then -1 would be itself a small value, We cannot find minimum no. Of coins hence we took INTMAX to minimize that value
@khushdevyogi6511 Жыл бұрын
Bro you are most helpful at this time for me😍
@DeepakSingh-fd2ix2 жыл бұрын
sir uda diya yeh video toh 😶😶😶😶😶😶
@iteself_me Жыл бұрын
186 ✅completed 👍Liked 09:29
@nishankdeep30842 жыл бұрын
thank you bhaiya bhaya poora ache se clear hua
@gopal_cse8 ай бұрын
correction : include int solveRec(vector &num,vector &dp, int x){ if(x==0) return 0; if(x
@dewanshyadav60332 жыл бұрын
❤️❤️❤️❤️❤️Bhaiyya this problem is solved using (Recursion+Memoization) method also ...you have not passed the dp array in recursive call => int ans = solveMem(num,x-num[i],dp); the why it was giving TLE error.... and Thank you bhaiya for this amazing lecture... ❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️❤️
@shoumickbardhan14602 жыл бұрын
Well, I don't know about other platforms, but this by far the best DSA series ever made available on KZbin. That too even Free. Lots of Love Bhaiya😊😊
@sukhjitsingh9592 жыл бұрын
Yes here is problem to understand this code ..you are explain very fast about this code if you do little slow explain with dry run will be more cool thanks
@unknownuser6143 Жыл бұрын
Awesome... very nice bhaiya...sab kuchh achchhe se samajh me aaya.
@aryankhatana72022 жыл бұрын
Namaste Bhaiya App ne jo solveMem function me for loop ke andar solveRec ko kol kiya hai isliye TLE aya hai agar app solveMem karogye to correct answer ayega Thankyou Bhaiya for this Amazing C++ With DSA Course
@jaisriRam42 жыл бұрын
Great work bhaiya ji ❤️❤️❤️
@RaviRavi-kt9gt Жыл бұрын
Starting my dp series from today 😀
@kumarpawansahh2 жыл бұрын
Dhanya ho gye bhaiya ji
@amishapandey6875 Жыл бұрын
Thank you bhaiya!
@PRIYANSHUKUMAR-un9zu2 жыл бұрын
Present bhaiya ❤✌🔥
@ramankr0022 Жыл бұрын
Very helpful. Thanks for uploading.
@AJEETSINGHYADAV-g1n Жыл бұрын
@CodeHelp Bhaiya we need to update the dp[x] in for loop itself for Memoisation Method for(int i=0;i
@yashraghuwanshi77107 ай бұрын
sir please dry run each code it make it more easy to understand concept and it work as memorization for us
@antimr2808 Жыл бұрын
thank you so much for creating this video
@Dhairyagaurr2 жыл бұрын
Babber bhaiya, Add these videos in DSA Series
@jaydwarkadhish9592 жыл бұрын
Sir amazing video super
@codewith_ayushluthra52482 жыл бұрын
thank you bhaiya
@kalpi50233 ай бұрын
thank you bhaiyaa
@abhishekverma15282 жыл бұрын
consistency++
@pramantomar8222 жыл бұрын
Loving the series ❤️❤️❤️❤️❤️❤️❤️❤️
@ayushgupta1881 Жыл бұрын
Thank you soo much bhaiya
@nikhilchopra8919 Жыл бұрын
Bhaiya maza aa gaya +++++++++++++++++++++++++++++
@sarthaknikhal55402 жыл бұрын
Acha padha rahe ho
@itspurelypassionate2 жыл бұрын
These series is so fuckn helpful. Thanks!!
@rahul191jain2 жыл бұрын
I think memorization method is throwing tle because inside that method, recursive function of method 1 is being called rather than memorized one.
@gauravkumar30362 жыл бұрын
Nope
@vortexdeo45452 жыл бұрын
5:58 A lot going on in mind, Microsoft Resignation wale time ke aas paas ki video hai
@nayanjaiswal2 жыл бұрын
Consistency op 😁
@vortexdeo45452 жыл бұрын
29:25 Burnout. Tough times.
@Aryan-se7zh Жыл бұрын
WHY CAN'T WE DO THIS BY THIS APPROACH? #include #include int minimumElements(vector &num, int x) { int n = num.size(); if(x == 0) return 0; int ans=0; sort(num.begin(), num.end()); for(int i=n-1;i>=0;i--){ ans += x/num[i]; x = x%num[i]; } if(x == 0) return ans; else return -1; }
@manikantadevadiga7146 Жыл бұрын
sort.
@johnangelo20009 ай бұрын
@7:22 "Kaise niklega answer !! Arey Bhaiya bahut simple lag raha hai thoda sa !! Theek hai !!!" ..
@Abc-lr4bf Жыл бұрын
understood very well
@nayanjaiswal2 жыл бұрын
Present sir 🙏
@mohitdeo780 Жыл бұрын
if (target
@yashwantmishra91092 жыл бұрын
Watching you design course 🙂
@energy45623 ай бұрын
love you bro 😍
@sukhjitsingh9592 жыл бұрын
Sukhjit present here nice 👍
@amaljogy43192 жыл бұрын
Incase anyone wants the right Memotizatoin code by recursion -> int solveMem(vector& coins, int n, vector& dp){ // base case if(n==0) return 0; if(n
@VikramSingh-cc6np2 жыл бұрын
mja aa gya bhaiya best quality content free of cost dekh ke
@jyotiradityayadav62472 жыл бұрын
Bhaiya memoization TLE nhi dega Aapne Memoization me recurssion wale function ko call kr diya hai isliye woh TLE dera uski jagah memoization wale function ko call kroge toh shi ans dega solveMem(num, x-num[i],dp);
@sounaksaha14552 жыл бұрын
+1
@priyankajhamb70612 жыл бұрын
Thankyou Sir
@JohnSmith-uu5gp Жыл бұрын
Awesome 🥰
@SajanKumar-ec2us Жыл бұрын
Include why memoisation and dry run of tabulation
@saqibmasood5012 жыл бұрын
sort krke aur optimize krskte the kya
@shubhamistic Жыл бұрын
on 11:19 you are not returning ans from main function i.e "minimumElements" so how you are able to get your all test cases passed ??
@paarthpatel8612 жыл бұрын
Keep doing it
@m.afnan20182 жыл бұрын
LoveForBhaiya++;
@shubham576412 жыл бұрын
Memoization code was absolutly fine there was only one mistake making recursive calls int Helpher_minimumElents(vector &num, int x,vector &DP) { //bse case if(x==0)return(0); if(x
@sakilahmed2911 Жыл бұрын
I noticed that
@sagnikmodak4178 Жыл бұрын
thanks sir
@rishitshah26022 жыл бұрын
8:20 WhatsApp notification came
@sahilanand302 жыл бұрын
🔥
@AshutoshEE- Жыл бұрын
Swad++ bhaiya🙏🙏
@randomguy7246 Жыл бұрын
bhaiya DRY RUN isme aapne nai kraya jaise pehle me krwaya tha wo x-num[i] relation etc usse smjhne me assani hoti
@BereniceVirginis10 ай бұрын
what about using greedy algorithm, I think it will improve our solution
@kanhaiyalalkumawat70552 жыл бұрын
superb
@AbhishekGupta-cg2vj2 жыл бұрын
not understood bhiayaa
@silverlining7778 Жыл бұрын
helpful video
@Its_._aayush Жыл бұрын
maja aagya
@vishalgarna4580 Жыл бұрын
Samajh+++
@vishalgarna4580 Жыл бұрын
Achi hai
@insaafarmy786 Жыл бұрын
sab dimak k upper sey
@eprithvikushwah4754 Жыл бұрын
Maza aaya
@DurgaShiva7574 Жыл бұрын
out of ALL the videos which you have made til date....this is the first , and the only video.. jaha pe mereko samajh nahi aaya :(