DP 24. Rod Cutting Problem | 1D Array Space Optimised Approach

  Рет қаралды 185,793

take U forward

take U forward

Күн бұрын

Пікірлер: 674
@takeUforward
@takeUforward 2 жыл бұрын
We completed DP on Subsequences, can you solve any question now on this topic :P
@AnilKumar-bv5sr
@AnilKumar-bv5sr 2 жыл бұрын
Thanks for the content, high on confidence
@rechinraj111
@rechinraj111 2 жыл бұрын
I m having 10+ yrs of experience in JAVA. I guess it's sufficient for us also. Before leaving India would u be able to complete DP series? Kindly don't leave in-between.
@sirajkhan0825
@sirajkhan0825 2 жыл бұрын
Definitely Yes!!!
@yashroy7436
@yashroy7436 2 жыл бұрын
Can the Lecture Notes be updated from DP-16 onwards? It is a something which makes your series unique from other creators, as it makes revision also much more easy! :)
@takeUforward
@takeUforward 2 жыл бұрын
@@yashroy7436 sure, let m give u the link: takeuforward.org/dynamic-programming/striver-dp-series-dynamic-programming-problems/
@RangerDivine
@RangerDivine 2 жыл бұрын
Before I started watching your series on dp and recursion, my brain wasn't able to process recursion, so I completely avoided it. But your daily dose of dp is certainly changing that. Your content is no doubt good, but your energy is on a different level.
@sagartaak4017
@sagartaak4017 Жыл бұрын
TRUTH
@AshishKumar-ww1mr
@AshishKumar-ww1mr Жыл бұрын
now dp is all about writing recursion and after that its just a cake walk
@dpxy1599
@dpxy1599 Жыл бұрын
@@AshishKumar-ww1mr exactly if you can write the recursive brute force solution correctly then it's just a cake walk.
@sandeeperukulla498
@sandeeperukulla498 2 жыл бұрын
Hey Striver, I did the problem in all 4 approaches including 1D Array space optimization without watching the video. Your videos helped me a lot. Thanks, Striver. This is the best DP series out there.
@apratimdutta2223
@apratimdutta2223 Жыл бұрын
Your comment may be very satisfying for striver but he will also feel he lost some watch minutes!
@Anonymous_Coder
@Anonymous_Coder Жыл бұрын
@@apratimdutta2223 Even after solving there is always something new that you always get from his videos .
@anamikasadh7345
@anamikasadh7345 Жыл бұрын
🤣🤣@@apratimdutta2223
@kazuma0803
@kazuma0803 2 жыл бұрын
I can do questions I even feared to read now in just 10 minutes. Thanks a lot, Striver.
@scharmilahruthika250
@scharmilahruthika250 7 ай бұрын
I just have 2 days to learn DP. I am super thankful for my brother to suggest this. Now I am confident enough to solve problems. The way you teach from breaking down the problem statement to building up solution step by step is such a bliss. I was so confused looking at solutions on internet which would straight away be the space optimised. At times I couldn't understand why would take dp[n][target+1] length. All these confusions had built up anxiety and dp seemed allergic. Now I can sayyyyy DP IS FUN! Thanks Striver!!
@the-tech-jerry
@the-tech-jerry 9 ай бұрын
Just completed the dp on subsequence section and literally by the end I could solve the problem without looking at the video and skipping the recursion part itself. Outstanding job of compliling and explaing the dp process. So many DP lectures, blog posts out there but none of them covers the core idea of how the tabulation itself is achieved. Most of them consider tabulation as a totally different approach and make it magical instead of teaching it as an optimization step after recursion which makes it difficult to approach. Keep up the good work we need more people like you 👍the cherry on top is its free of cost ❤❤❤.
@kunalsaha9239
@kunalsaha9239 2 жыл бұрын
Your dp series is Marvelous. For me yes now I can able to solve dp problem atleast i can come up with the recursive steps quickly. But some times the base case part (specially thinking of base case part in tabulation is tricky) But I am quite sure that with practice I will make it good. Thank you so much for your efforts ❤️❤️
@amanbhadani8840
@amanbhadani8840 2 жыл бұрын
I already solved this question with all 4 approaches upto space optimization with 1 array before watching this video.This dp on subsequence part is running in our veins now.
@vineetsingh4707
@vineetsingh4707 9 ай бұрын
I have seen people saying that they struggle with DP a lot and this was my first time studying DP literally you made it so easy for me you made me so confident like just throw any question at me till now and i would do it for you to the last possible optimization thanks for this masterpiece and as always UNDERSTOOD everything.
@vatsalkudecha2746
@vatsalkudecha2746 2 жыл бұрын
I code all 4 solutions - recursion -> memoisation -> tabulation -> space-optimisation even before starting this video.....That's the confidence and knowledge one gets by following Raj bhaiya's DP series....Kuddos to you.... Raj bhaiya.....
@sshuk2307
@sshuk2307 2 жыл бұрын
Could you please share the link or notes here as well.
@sarthakvaish2520
@sarthakvaish2520 2 жыл бұрын
🙌
@shlok1124
@shlok1124 Жыл бұрын
This is an outstanding DP series. Even if you overlook your dedication to come up with 4 ways to solve 1 question in every video. Thanks for this.
@anandkalpe2155
@anandkalpe2155 Жыл бұрын
Understood !!! Literally man, what are you ! You just made it very very easy with your concepts, approaches, clean and short codes. Simply Great !!! And not to miss, You converted fear to joy smoothly :) Hats off to you man !!!
@chitranshjain5075
@chitranshjain5075 2 жыл бұрын
Thank you Striver! Successfully solved using all the 4 approaches by myself without watching the video. It's all because of you. A few months back I was afraid of DP and now I feel the most confident in DP, all thanks to you!
@nagasrikuncharapu3736
@nagasrikuncharapu3736 8 ай бұрын
after watching all the above videos , I was able to solve this question on my own completely. Thanks a lot
@arijitdas4560
@arijitdas4560 2 жыл бұрын
UNDERSTOOD......After this I went to leetcode and trying doing problem on dp on subsequences ....I had sloved almost every by my own except some problems ...Thanks for bringing this ,I really don't know how to express my gratitude towards you.
@pranjalthapliyal2278
@pranjalthapliyal2278 Жыл бұрын
Understood :) Been doing all the problems on my own for the last 10 problems or so, your content (and especially its ordering) is genuinely incredible
@nilimsankarbora5911
@nilimsankarbora5911 9 ай бұрын
Hey Striver, I did the problem in all 4 approaches including 1D Array space optimization without watching the video. Your videos helped me a lot. Thanks, Striver. This is the best DP series out there.❤❤
@rajatjain6103
@rajatjain6103 4 ай бұрын
Before I started watching your series on dp and recursion, my brain wasn't able to process recursion, so I completely avoided it. But your daily dose of dp is certainly changing that. Your content is no doubt good, but your energy is on a different level.
@udaypratapsingh8923
@udaypratapsingh8923 2 жыл бұрын
*with all three approaches* *approach1: recursion* int solve(int n , vector prices) { if(n == 1) return prices[0]; if(n == 0) return 0; int maxi = INT_MIN; for(int length = 1 ; length
@SYCOA12CHAITANYAASOLE
@SYCOA12CHAITANYAASOLE Ай бұрын
Understood !! Hey striver i solved this on my own with all aproaches. Thanks you are awesome !!
@YajingLiu-cl4tp
@YajingLiu-cl4tp 8 ай бұрын
Thank you!! Your videos truly help me!! When I listen to my professor's lectures, I find it difficult to keep up with the professor's pace most of the time. But when I watch your videos, I can easily follow up. And after watching your video, I can use the same strategy to solve different dp problems.
@santanu29
@santanu29 Жыл бұрын
Opened the video just to get the problem link. I got stuck in the take condition, but then did the rest till 1D array all by myself. Thank you for the great lectures.
@DevRathi-gl7gs
@DevRathi-gl7gs 3 ай бұрын
Thank you so much striver after watching this series i am enough confident that i can solve any question on subsequence pattern
@karthikravi2781
@karthikravi2781 2 жыл бұрын
Your DP series is extremely great!! Hats off for your effort!!
@parthsalat
@parthsalat 2 жыл бұрын
*Code timestamps* Recursion: 12:15 *Complexities* Recursion and memorization: 13:35
@akshayaashok8794
@akshayaashok8794 3 ай бұрын
You are the best Striver! I totally enjoyed DP on Subsequences, a topic I feared a lot, but now it has become a topic that I enjoy and solve. Understood it because of your awesome way of teaching, thank you bhaiya!!!
@DivyaKumari179
@DivyaKumari179 3 ай бұрын
UNDERSTOOD sir, Thanks for this amazing series.
@paramsratanpal6551
@paramsratanpal6551 2 жыл бұрын
Previously when i tried to solve this problem ,i was stuck,but today i was able to solve it in 1d space without even watching the vid,amazing content bro
@_Kunal_Pawar
@_Kunal_Pawar 8 ай бұрын
Understood! Since you've already explained these concepts so well in the previous problem, I was able to solve it on my own. Thanks, Striver! 💯
@gaganvishwakarma6494
@gaganvishwakarma6494 Жыл бұрын
I listen the problem and just remove the weight array from the fractional knapsack code as simple as that . All Thanks to striver.
@ayanangshudasmajumder112
@ayanangshudasmajumder112 Жыл бұрын
Understood entire DP on subsequence!!! Feels like i can make my own questions on this topic.
@saimanojporeddy6938
@saimanojporeddy6938 Жыл бұрын
Hii striver , I used same code we did for unbounded knapsack .Instead of weights vector I created a vector of size n whose value of each index =index+1 and then I passed it. It worked perfectly🤩. And more importantly I did this before watching this video😊😊. Thank you.
@deepankarsingh6212
@deepankarsingh6212 Жыл бұрын
did the same things bruh...
@MukeshKumar-cc3uh
@MukeshKumar-cc3uh 7 ай бұрын
This series provides immense clarity on the concepts ❤. DP on sub-sequences felt like a cakewalk. Thank you and Understood.👍
@preetisahani5054
@preetisahani5054 Жыл бұрын
Was able to solve via all 4 approaches without watching the video thank you so much for the playlist.
@jaividyasagarr7110
@jaividyasagarr7110 Жыл бұрын
Understood! Dp became cake walk for me only because of you. Thanks a lot. Very grateful to you.
@im_kishanpandey
@im_kishanpandey 2 жыл бұрын
Honestly speaking, I feared after I saw any DP problem, and now after coming this far I can write the tabulation code all in the first step... All thanks to this wonderful course by striver..
@stith_pragya
@stith_pragya 9 ай бұрын
UNDERSTOOD..........Thank You So Much for this wonderful video...........🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
@itsaryanb9316
@itsaryanb9316 Жыл бұрын
I was only confused with the base cases of this problem, had watched the lecture till recursion part, but solved this problem using all the 4 methods including 1-D Space optimised tabulated approach, all thanks to you Striver❤
@ishaanchandak4774
@ishaanchandak4774 Жыл бұрын
did this question myself . thanks a lot . i was not proficient with solving these kinda questions but now they seem easy .thanks a lot
@shubhankarsharma154
@shubhankarsharma154 Жыл бұрын
Now I'm confident enough to say that I can solve any question on DP on Subsequences... Thank you so much Striver .. 🔥🔥 Forever Grateful🙇
@jeelanibasha3984
@jeelanibasha3984 2 ай бұрын
You are extremely great i have solved all 3 approaches on my own 🎉
@rohitraj5832
@rohitraj5832 2 жыл бұрын
No one has expalined approach to his problem so well. keep growing and giving amazing contents.
@deepikalakshmi8306
@deepikalakshmi8306 9 ай бұрын
Thank you so much for posting very good quality lectures on data structures. It is very much helping in preparing for my dream job
@johar3737
@johar3737 2 жыл бұрын
Understood. Many Many Thanks Sir. Your teaching style is absolutely awesome.
@maruthibabutirupati2583
@maruthibabutirupati2583 Жыл бұрын
Understood from recursion to 1D array optimization. Thank you so much for your awesome series.
@tasneemayham974
@tasneemayham974 Жыл бұрын
Recursion, Memoization, Space Optimization, and 1D array optimization ALL BY MYSELFFFF!!!!!. THANK YOUUUU STRIVERRRRR!!!!! YOU'RE THE BEST TEACHER EVERRR!!!!!! DP ON SUBSEQUENCES EASYYYY PEASSYYY LEMON SSQUEAZZYYYY!!!!!!!! 💯💯💯💯💯
@nsmworldentertainment4687
@nsmworldentertainment4687 Жыл бұрын
I hope I will be able to solve any question in this pattern. Understood all problems taught so far. Thank you very much. Its just time to practice now.
@codewithyou311
@codewithyou311 2 жыл бұрын
After viewing from starting to till 3 min. i have solved this problem from recursion to space optimization. :)
@hardikjain6397
@hardikjain6397 2 жыл бұрын
wonderful series it is, completed this question in 4 minutes without watching the video.
@udatyadeb101
@udatyadeb101 Жыл бұрын
understood ! was able to solve the problem all by myself till 1d space optimization.
@aagamjain2131
@aagamjain2131 Жыл бұрын
You made me feel confident in DP And yes, UNDERSTOOD 🔥
@addictivepcmbyazaan4700
@addictivepcmbyazaan4700 7 ай бұрын
Bhai ..your dp series is damn amazing it is one of the best dp playlist in the world ...where you cover each and everything
@adityasaxena6971
@adityasaxena6971 Жыл бұрын
Done this question by all 4 approaches ,Thanks Striver
@iamb92
@iamb92 2 жыл бұрын
Hello Striver, your videos have been very useful to me and my research project (I am facing a lot of optimization problems). I've already had experience in solve DP problems, but your approach definitely take me forward =), regards!.
@gkm0.150
@gkm0.150 2 жыл бұрын
Previously I found many difficulties in DP but after following your DP series I feel comfort in DP Without seeing this video I solve this question only by your approach... in previous Question thanks a lot sir and I think this is one of the best DP series....
@stith_pragya
@stith_pragya 9 ай бұрын
Now, after watching Striver Bhaiya's DP series, I can solve any problems from DP.
@Aniket_0314
@Aniket_0314 8 ай бұрын
I ain't watching the videos for the approaches , with just a little consistency of less than 2 weeks i'm able to solve most of the problems until now. I still came here to write on this video because i think bhaiya you deserve to know this how awesome playlist you've created. God bless you and your family ❤
@arjundutta1515
@arjundutta1515 8 ай бұрын
You make dp on subsequences so so easy..... really you are great.... ❤❤❤
@rishabhkalra9505
@rishabhkalra9505 2 жыл бұрын
Surprisingly, a similar variant was asked to me in 1st round of Microsoft interview
@sahilgagan2242
@sahilgagan2242 2 жыл бұрын
JOB MILA
@sahilgagan2242
@sahilgagan2242 2 жыл бұрын
pls reply
@Dishankgarg-e6t
@Dishankgarg-e6t 7 ай бұрын
without watching the solution, i solved it by my self , thank u striver
@morgaming9736
@morgaming9736 10 ай бұрын
Understood..Great job!! May the good Lord bless you for all good that u are doing!!
@crazyaryalucky42
@crazyaryalucky42 4 ай бұрын
Your DP Series is extremely of Next Level
@rishabhgupta9846
@rishabhgupta9846 Жыл бұрын
understood,able to solve by myself.After mapping it to 0/1 Knapsack ,it was cakewalk.But mapping it to 0/1 Knapsack currently is easy as I'm solving DP subsequence problem right now.But in future mapping and remembering will be most important part.
@muntajir646
@muntajir646 Ай бұрын
When ever your heart is broken. Don't ever forget you are golden! Understooood !
@aakashshelake
@aakashshelake 5 ай бұрын
solved this problem in all the ways without watching this video🤩Striver bhaii🔥
@satwikaadusumilli7534
@satwikaadusumilli7534 Жыл бұрын
This is my first ever comment in your playlist. I was able to do the question myself. I significantly see a definite change in me. Thank u sooo mucchh striver🥰. I understood dp only becoz of u.
@vamsikrishnareddy9345
@vamsikrishnareddy9345 2 ай бұрын
Understood Striver !! Cheers 🎉
@NAVEENKUMAR-uj7xe
@NAVEENKUMAR-uj7xe 2 жыл бұрын
Thanks for providing these important series with full effort. Hope many like me would take benefit of it
@splinkerp2222
@splinkerp2222 2 жыл бұрын
Bhaiya your couse is a premium course. Thanks for giving us it for free. Very thankful to you 😊
@Coder-zz1tn
@Coder-zz1tn 5 ай бұрын
I have started to solve the problems by myself, thanks to you bro
@rohitanand7071
@rohitanand7071 4 ай бұрын
FInally solved Question without watching video , thanku man.
@rajharsh3739
@rajharsh3739 11 ай бұрын
Solve this without seeing solution . i have to say that i m loving the process 🔥🔥. BTW bhaiya , many many congrats for getting promoted to SWE 3 at Google . 😃😃
@tejashwinibadi9984
@tejashwinibadi9984 2 жыл бұрын
Understood. Thank you so much. I was able to figure out the logic on my own for this problem.
@TanishqAnand
@TanishqAnand 2 жыл бұрын
After watching these videos I am able to solve the problems till 2array space optimization by myself!!!!! kudos to striver!!!!
@vishnubanjara5209
@vishnubanjara5209 Жыл бұрын
This playlist is created for build a confidence in every student that he can do anything with coding
@sanchitbhadgal4303
@sanchitbhadgal4303 2 жыл бұрын
I can't believe bro, Done the question without the video. Thanks Alot Striver.
@dipaligangawane980
@dipaligangawane980 2 жыл бұрын
Thank you so much Striver for wonderful lectures on DP.
@shuvo9131
@shuvo9131 2 жыл бұрын
Yes I got the confidence that dp on subsequence is easy topic now. Thank for the awesome series.
@NavneetKumar-lg3nv
@NavneetKumar-lg3nv 3 ай бұрын
sir in this problem notes you have uploaded the notes of unbounded knapsack problem. please fix it as in java code it is giving stack overflow error
@shivanshumishra0560
@shivanshumishra0560 Жыл бұрын
understood sir !!! and yes I am confident enough to solve any problem on dp on subsequences !!!!! Thanks a lot sir for this entire series ❤❤❤❤
@logeshv2125
@logeshv2125 3 ай бұрын
Understood striver! through your teaching way, it is easy getting into dp day by day, it's because of you only Striver❤✨
@sanginigupta1312
@sanginigupta1312 2 жыл бұрын
Completed! I feel very confident now
@wilhelmrudolphfittig3577
@wilhelmrudolphfittig3577 3 ай бұрын
exact same code of unbounded knapsack passes thanks striver 👍👍
@VivekSharma-eh2tv
@VivekSharma-eh2tv 3 ай бұрын
hey striver after watching through the lectures iam able to do this problem on my own ...
@shripandey4120
@shripandey4120 2 жыл бұрын
amazing...today is diwali and I am watching your videos.
@sriharshakandurivenkatases2587
@sriharshakandurivenkatases2587 Жыл бұрын
Best DP series I could ever watch!
@generationtech4350
@generationtech4350 Жыл бұрын
The best dp playlist available in the market. Before this i had confusion whether to continue with love babbar or start strivers do. Best decision i've made for a while.
@sajaljain8144
@sajaljain8144 2 жыл бұрын
thanks brother, following you playlist and the rules - they are super useful.
@parulgarg5362
@parulgarg5362 Жыл бұрын
Understood! However, in base case, there should be condition of if RodLength is exhausted, because waiting to reach 0th index even if rod length was exhausted, made us do unnecessary "not-pick" calls several times.
@instinct1098
@instinct1098 10 ай бұрын
I can now solve this type question!! Thanks a lot striver
@aadharjain313
@aadharjain313 Жыл бұрын
for those who are thinking why we are making recursive call with same index again and again when we pick it , its a small logic. In previous questions of dp on subsequences, we had constraint that if we pick an index then it cannot be picked again in calculating that particular answer (particular branch if you think it by drawing recursion tree). since in this question we are allowed to take same length even more than 1 time , that is why rather than going to previous index we try to check if the curr length can be again cut off from the rod. eg- N=10 and idx=4 i.e rod length= 5 , so we will check for length =5 and then rather than going to check for length =4 , we will check if we can cut length=5 again , since it is allowed to cut multiple same lengths. and we cannot cut same length more than once , simply "not take" will go ahead and continue the flow of recursive calls
@dhruvarora8136
@dhruvarora8136 Жыл бұрын
Loved this. Thank You So So So Much
@kiransekhar9510
@kiransekhar9510 Жыл бұрын
i am able to solve any problem based on subset/subsequence... thanks to you
@amankrsingh
@amankrsingh 2 жыл бұрын
Understood, and now I'm able to solve or try subsequence dp problem
@balwantyadav724
@balwantyadav724 2 жыл бұрын
yea now I can any questions on subsequences. Thanks a lot sir...
@sanyamwalia217
@sanyamwalia217 Жыл бұрын
Dp on sub sequences nicely explained !! 👍
@kotipallimadhumeher71
@kotipallimadhumeher71 2 жыл бұрын
happiness is when u r doing the dp on your own😁😁 thnks striver bhaaii !!!
@cinime
@cinime 2 жыл бұрын
Understood! Thank you very very much such an amazing series of explanation!!
@mohitlenka7777
@mohitlenka7777 6 ай бұрын
understood and able solve the problem on my own int cutRod(vector &price, int n) { // Write your code here. vectordp(n+1, 0); dp[0] = 0; for(int N=1; N
@lohitaksha244
@lohitaksha244 2 жыл бұрын
Understood, Loved your approach to dp in general.
14  Rod Cutting Problem
18:53
Aditya Verma
Рет қаралды 288 М.
How it feels when u walk through first class
00:52
Adam W
Рет қаралды 21 МЛН
Watermelon magic box! #shorts by Leisi Crazy
00:20
Leisi Crazy
Рет қаралды 116 МЛН
Крутой фокус + секрет! #shorts
00:10
Роман Magic
Рет қаралды 41 МЛН
My Daughter's Dumplings Are Filled With Coins #funny #cute #comedy
00:18
Funny daughter's daily life
Рет қаралды 30 МЛН
DP 23. Unbounded Knapsack | 1-D Array Space Optimised Approach
22:54
take U forward
Рет қаралды 121 М.
Lecture 107: Cut Rod into Segments of X, Y, Z || DP Series
24:39
CodeHelp - by Babbar
Рет қаралды 76 М.
I Solved 100 LeetCode Problems
13:11
Green Code
Рет қаралды 112 М.
Fastest Way to Learn ANY Programming Language: 80-20 rule
8:24
Sahil & Sarra
Рет қаралды 886 М.
DP 22. Coin Change 2 | Infinite Supply Problems  | DP on Subsequences
22:17
DP 34. Wildcard Matching | Recursive to 1D Array Optimisation 🔥
43:52
Rod Cutting - Dynamic Programming
15:22
CSBreakdown
Рет қаралды 154 М.
[Algorithms] Dynamic programming for solving the rod cutting problem
14:53
How it feels when u walk through first class
00:52
Adam W
Рет қаралды 21 МЛН