Bhaiya u r God sent angel. God heard the upcoming SDE's cry the whole nights, and then planted the idea of making DSA playlists in your head. Bowing to your intellect, dedication and hardwork .
@OnstreamGaming11 күн бұрын
the energy he dedicates in each of his videos is extremely commendable even at 2 am , 3 am, 4 am, he had made the video still so much energy and dedication.
@gyanunlimited7402 жыл бұрын
Its been 6 years since I came across this topic and finally understood it today
@trijalsharma4471 Жыл бұрын
you've been unemployed for quite some time 😆
@codingalley62294 ай бұрын
@@trijalsharma4471 solving a damn specific problem doesn't mean you are smart buddy.
@PankajYadav-zg1re2 жыл бұрын
Finally I got the exact idea how the recursion works in MCM problem , before your vdo I have watched a lot but didn't get clear idea ......You are awesome bhaiya ❤️❤️❤️❤️
@ayushjain3862 жыл бұрын
Can you help me i am not understand steps= a[i-1]*a[k]*a[j]+func(i,k)+func(k+1,j) Why are again call function func (i,k)+func(k+1,j) again
@sanketmudholkar28892 жыл бұрын
@@ayushjain386 Because we have to compute the smaller part also like if we have (ab) and (cd) so we have to solve ab and cd seperately also .
@prakharsingh97102 жыл бұрын
@@ayushjain386 bro,suppose (AB)(CD) hai to finally AB * CD krne ka cost aaya hoga but (A*B) apne aap me bhi ek ques h n isko multiply krne me bhi cost aaya hoga to usko nikalne ke liye func(i,k) use kiya hai. Similarly, (C*D) ko bhi krna hoga jo ki other left over part hai partition ke baad to usko func(k+1,j) likha....! Thoda pen chalao or video waps dekho aajayega
@anmolagarwal5950 Жыл бұрын
That's the best video ever on Partition DP 👏 so much effort goes into making such content for generations, hats off man 👏👏
@ganeshkamath892 жыл бұрын
Thanks Striver. Understood. 6 months back I had tried to learn it but I found it difficult. With your explanation I think I will remember how to do MCM and partiton DP.
@digvijaysinghchauhan57952 жыл бұрын
I tried it multiple times earlier but now I got better understanding, indeed it will stuck in my mind now.
@madhuryareddy39948 ай бұрын
Thanks for existing man, you don't know how thankful I am🙏🙏you made this explanation such that I can never forget this concept in my life.
@aayushisaha82 жыл бұрын
👏👏👏 To everyone who made it this far !! And Double 👏👏 for those who didn't 💤 during this video . Cause it's a reallly long video ( ig mini movie 😅) . And just thinking of how much effort Striver bhaiya must have gone though to make it , edditing it , correcting it 👏👏 , Frankly speaking of me I dozed off 😪 a couple of times during the entire video 🤪 . But anyways Great Work , Striver bhaiya ✌
@momozkichutney2 жыл бұрын
arey aaram se bolo didi, ye beech beech mei daure pad rhe h kya!
@girishbhargava63672 жыл бұрын
@@momozkichutney 🤣🤣🤣🤣
@AshokKumar-ii4qr Жыл бұрын
@@momozkichutney wo stree h k6 v kr skti h 😂😂
@kon_humein9 ай бұрын
Lgta hai didi zyda moody hai bich bich itna mood swings 😂
@theexplorer90125 ай бұрын
ye kya bawasir likh diya be
@stith_pragya10 ай бұрын
UNDERSTOOD...Thank You So Much for this wonderful video.......🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
@DeadCode_Debugs18 сағат бұрын
i will tell again again and again this man is GOAT of dsa no matter what ppls are there in youtube who are teching dsa ,, he is always the goat
@OnstreamGaming11 күн бұрын
the energy he dedicates in each of his videos is extremely commendable even at 2 am , 3 am, 4 am, he had made the video still so much energy and dedication.
@rishavsaha52542 жыл бұрын
Understood. Before starting this topic, I had 0 knowledge about this topic, now after completing this video, I am taking the complete concept. Thank you so much for coming up with this amazing DP series striver.
Hey Striver again thanks to you for teaching in such a wonderful way. I paused the video at 25:30 after understanding the approach to the problem and was able to solve upto memoization by myself. Thanks man keep up the good work.
@sathwikabhignan18625 ай бұрын
my goodness!! crystal clear explanation I am grateful for your dp series, thank you, Striver.
@shashwatdhingra3580 Жыл бұрын
Best Ever Explanation for MCM. Literally!
@sameersahu45692 жыл бұрын
What an explanation....Partition was a concept i was not much clear with ..... Thank you for making me understand this concept
@dhikshithgoshika27002 жыл бұрын
wah wah got the depth of deep recursion took me 2 days to completely write the total recursive code and understand .really striver bayya if you and your videos are not there many of us would leave hopes for preparing other companies , may god give you all the health and wealth bayya 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
@Mr.Indianwxvhehsy9191hghgx Жыл бұрын
thanks gyani baba@boomsi69
@sakshigupta47932 жыл бұрын
TBH for dp series Aditya Verma & you are the best. 😊
@arijitdas45602 жыл бұрын
understood that is not a question this a concept .... hats off to your efforts man you are just amazing
@Noob_Coder12349 ай бұрын
HATS OFF TO THE GOAT STRIVER , HE HAD PUT LOT OF EFFORTS FOR US IN THIS VIDEO SO WE CAN UNDERSTAND THIS TOUGH TOPIC , REALLY AMAZING❤❤
@chanchalroy341710 ай бұрын
Just understood the whole concept of partition DP at one go 🙌😌🔥
@madhavdwivedi5146 Жыл бұрын
kya mast padhaya hai.....aapko dekhke mera khud padhane ka man hogya...❣❣❣❣❣❣
@rohan87583 ай бұрын
Understood, I am feeling very sleepy, time is 2:11 AM but this video motivate me to watch it till i understand it completely, lot of Thanks @Striver for your DP Series!!!!
@priyanshkumar174 ай бұрын
Excellent explanation - Partition DP Starts!!!
@arnabsarkar524523 күн бұрын
Tussi great ho bhaiya, koti koti pranam aapko 🙏🙏
@VinayKumar-ze2ww2 жыл бұрын
Another great video, thanks striver for making me understand MCM 50 minute sound huge but it just flew by
@vivekpaliwal1876 Жыл бұрын
I like your vedios...your way of teaching is good...but 1 thing you can add at start of vedios that which application uses this algorithm just to increase interest in learning the algo...
@dhirenpatil86002 жыл бұрын
Really nice explanation srtiver. I like the way that you teach and understood the MCM.Very tricky but now understood.
@deepti892010 ай бұрын
The best video on partition DP I came across! Good job!
@108_adityakumar62 жыл бұрын
Understood.🔥🔥Your dp series is best.
@JothiprakashThangaraj4 ай бұрын
Got it when going through coluple of times thanks a lot !!!
@TXS-xt6vj Жыл бұрын
Just like messi, no one can be better than this teaching, so underrated
@cgoxo2 жыл бұрын
It takes a lot of effort to explain more than one example in detail. Thank you so much for this.
@shivanssingh48972 жыл бұрын
Hi Striver, can you explain problems on pattern dp like burst baloons etc. Your explaination is very good btw.
@takeUforward2 жыл бұрын
Soon!
@shreyasingh12582 жыл бұрын
@@takeUforward jaldi le aao bhaiya, can't waitt!
@aftabalam71032 жыл бұрын
Very clear and solid explanation,Thanks buddy
@rupamhari1152 жыл бұрын
MCM was always been a nightmare for me, and now, I finally understood. Thank you so much bhaiyaa!! 🙏🙏🙏🙏
@adarsh_k_agrawal6 ай бұрын
Understood LIS Pattern completely. Watching all the videos from the start of DP. It is really really helpful. Every concepts are clear and will surely finish the playlist. Thank you Striver, emiti amazing content pai.
@ronakslibrary8635 Жыл бұрын
Understood , difficult concept explained easily🤯🤯
@ritikshandilya70754 ай бұрын
Thankyou for amazing solution Striver
@sumeetkumar49843 ай бұрын
bhaiya bahut accha samjhaya....thanks a lot
@fmkhandwala39 Жыл бұрын
AMAZING EXPLANAITION AS USUAL!
@anirbannaskar5495 Жыл бұрын
I have not seen such good explaination for this problem bhaiya, thanks for making such good conceptual problem!!
@juniorboy19032 жыл бұрын
It's hard but u have made it very easy to understand thanks bhaiya 😃😍
@TXS-xt6vj Жыл бұрын
No one can be better than you striver
@ritwik1212 жыл бұрын
@striver Great explanation ... hope you will making a video on burst ballons and how to think for that problem ...
@raghavmanish243 ай бұрын
MJHE BELEIVE NHH THA PHLE KI MAI YE TOPIC SMJH LUNGA EK BAAR ME .....BUT STRIVER MAKE IT EASY ......#UNDERSTOOD
@sanskarkumar028 Жыл бұрын
very calm and easy solution . thanku u striver
@cricketwala937 Жыл бұрын
this is the best lecture on MCM till the date . 🔥🔥🔥
@JohnSnow-r1e4 ай бұрын
Give this guy 10M subscriber by the end of the 2024
@samyakjain74222 жыл бұрын
areeee bhaiyaaa omphooo!!! zammmn bhai understood....saying this video is god damn amazing is an understatement.
@rohitn63332 жыл бұрын
Thanks a lot for such a wonderful explanation sir :)
@parthsalat2 жыл бұрын
The Great Rohit Negi is here!
@prettylilnerdy6802 Жыл бұрын
Nice tricks for solving all partition dp
@shivisingh99757 ай бұрын
Understood! very well explained
@suryanshsingh53043 ай бұрын
Understood! Hats off🙏
@UECAshutoshKumar5 ай бұрын
Thank You Understood!!!
@suyashjain3223Ай бұрын
Amazing Explanation!!!
@TXS-xt6vj Жыл бұрын
Absolutely world class
@cinime2 жыл бұрын
Understood! Thank you sooooo so SO much as always!!
@gentleman7060 Жыл бұрын
All of your dp problems should have one playlist. It would be helpful.
@arnoldsmith6584 Жыл бұрын
It is there bro in a single playlist
@parthsalat2 жыл бұрын
I'm blind...how am I supposed to watch this insightful lecture 🥺
@rohandevaki43492 жыл бұрын
thankyou bro, very clear and easy explaination .
@akashsri3 Жыл бұрын
The thing about him that his so authentic is that he actually solves the problem at point of time he does not not memorize the solution and show
@manasranjanmahapatra37292 жыл бұрын
Super Clear Understood.
@sauravchandra10 Жыл бұрын
Clearly understood, thanks!
@itishachoudhary9063 ай бұрын
Thank you Sir ! Understood.
@UCSDebajyotiDas Жыл бұрын
The code studio question is little bit changed now f(1,n,arr) will work instead of n-1
@Parthj4264 ай бұрын
awesome lecture striver , understood
@chandrachurmukherjeejucse5816 Жыл бұрын
Solved the question after watching just 15:43 all thanks to striver ❤
@Zunan2632 жыл бұрын
Thanks a lot man plz donot stop ur series today there might be very less reach imagine after 6 months u will get shocked by reach just plz donot stop posting vedios
@AbhishekYadav-rm4hw Жыл бұрын
shouldn't the base case be if(j==i || j==i+1) return 0; as when j = i+1 then also there is only one matrix which is possible and then also we can't multiply. Edit: I appologize, I got it now
@anonymousvoid63562 жыл бұрын
Dont stop making videos man !!!!!!!
@michael-pasquale2 жыл бұрын
Understood. Excellent explanation!
@Zunan2632 жыл бұрын
Plz plz plz dp on graphs asap love ur work 🙏❤️
@gauravbanerjee28985 ай бұрын
Thank you so much striver ❤❤
@sukhpreetsingh5200 Жыл бұрын
Awesome Just amazing lecture😃
@rishabhagarwal80492 жыл бұрын
Understood Sir, Thank you very much
@anukulgaurav30432 жыл бұрын
Best video I have ever seen on dp🔥
@siding669011 ай бұрын
#include int solve(int* arr, int i, int j){ if(i == j) return 0; int mini = 1e9; for(int k = i; k
@RanjanSingh-wf9iq10 ай бұрын
size of array is n+1
@DevashishJose10 ай бұрын
Understood Thank you so much
@vishwasrajbatham59982 жыл бұрын
Understood. Helped a lot !
@ashishchourasia2830 Жыл бұрын
Hands down the best explanation.
@TXS-xt6vj Жыл бұрын
Legend , legend, legend
@ektabansal7645 Жыл бұрын
Thanks a lot striver for this series, it is damn helpful!!
@abhisheksinghdangi5027Ай бұрын
I have seen, revised twice the entire series till now and maybe will continue with this part later coz companies dont ask this hard for frwshers here.
@bakyt_yrysov Жыл бұрын
Thank you soo much!! Please, keep posting such this amazing content!
@vidhigupta3769 Жыл бұрын
understood. Thanks Striver!!
@OnstreamGaming11 күн бұрын
Watched full episode of my Dp named Web SHow - THanks streiver
@codelearner3355 Жыл бұрын
UNDERSTOOD ,THANKS!
@blurrybrush10102 жыл бұрын
finally,thank u striver for this series
@ayonsinha20752 жыл бұрын
bhai can you please tell me why i*j =n*n.....j==n that got it but why i is n
@shubhadarajmane73232 жыл бұрын
Thanks ,you helped me a lot.
@prantikofficial2 жыл бұрын
Understood completely!
@ratinderpalsingh5909 Жыл бұрын
Understood, sir. Thank you very much.
@sanaaroraa93155 ай бұрын
Amazing! understood
@anandpandey9184 сағат бұрын
Unbelievable explanation /* * Two matrices can be multiplied if and only if the number of columns * in the first matrix is equal to the number of rows in the second matrix. * * Let the matrices be: * Matrix A with dimensions m × n: m rows and n columns. * Matrix B with dimensions p × q: p rows and q columns. * * Resultant Matrix: * If Matrix A (of size m × n) is multiplied with B (of size p × q) * (where n = p), the resulting matrix C = A × B will have dimensions * m × q (i.e., m rows and q columns). * * The total number of multiplication operations required will be: m * n (or p) * q */ //Bruteforce Approach class Solution { static int matrixMultiplication(int arr[]) { /* * Call the helper function with the full range of matrices (from the first matrix to the last matrix). * The matrix dimensions are represented by arr[i-1] x arr[i] for matrix i. */ return minOperations(arr, 1, arr.length - 1); } private static int minOperations(int arr[], int start, int end) { // Base case: When there is only one matrix in the chain, no multiplication is needed. if (start == end) { return 0; } int minimumMultiplicationCost = Integer.MAX_VALUE; /* * Matrix Chain Multiplication (MCM) Problem: * Given 4 matrices with the following dimensions: * Matrix 1: A of size 10×30 (10 rows, 30 columns) * Matrix 2: B of size 30×5 (30 rows, 5 columns) * Matrix 3: C of size 5×60 (5 rows, 60 columns) * Matrix 4: D of size 60×80 (60 rows, 80 columns) * * We will have the following partitions: * * 1. Partition 1: A × (B × C × D) * - Step 1: Multiply B (30×5), C (5×60), and D (60×80): * B×C results in a 30×60 matrix. * (B×C)×D results in a 30×80 matrix. * Multiplication Cost = 30×5×60 + 30×60×80 = 9000 + 144000 = 153000 * - Step 2: Multiply A (10×30) with the result of (B×C×D) (30×80): * Multiplication Cost = 10×30×80 = 24000 * - Total Multiplication Cost for Partition = 153000 + 24000 = 177000 * * 2. Partition 2: (A × B) × (C × D) * - Step 1: Multiply A (10×30) and B (30×5): * Multiplication Cost = 10×30×5 = 1500 * Resulting matrix is 10×5. * - Step 2: Multiply C (5×60) and D (60×80): * Multiplication Cost = 5×60×80 = 24000 * Resulting matrix is 5×80. * - Step 3: Multiply (A×B) (10×5) with (C×D) (5×80): * Multiplication Cost = 10×5×80 = 4000 * - Total Multiplication Cost for Partition 2 = 1500 + 24000 + 4000 = 29500 * * 3. Partition 3: (A × B × C) × D * - Step 1: Multiply A (10×30), B (30×5), and C (5×60): * Multiplication Cost = 10×30×5 + 10×5×60 = 1500 + 3000 = 4500 * Resulting matrix is 10×60. * - Step 2: Multiply (A×B×C) (10×60) with D (60×80): * Multiplication Cost = 10×60×80 = 48000 * - Total Multiplication Cost for Partition 3 = 4500 + 48000 = 52500 * * Summary of Multiplication Costs: * 1. (A × (B × C × D)) → Total cost = 177000 * 2. ((A × B) × (C × D)) → Total cost = 29500 * 3. ((A × B × C) × D) → Total cost = 52500 * * Optimal Order: * The optimal way to multiply these matrices is (A × B) × (C × D), which gives the minimum multiplication cost of 29500 operations. */ // Iterate through all possible partitions to find the optimal way of multiplying. for (int partition = start; partition < end; partition++) { /* * NOTE: * In Partition 2: (A × B) × (C × D), the recursive approach helps break down * the matrix multiplication into smaller subproblems: * * Step 1: Multiply A (10×30) and B (30×5): * - This is done by the recursive call minOperations(arr, start, partition). * - The multiplication cost is calculated as: 10×30×5 = 1500. * - The resulting matrix has dimensions 10×5. * * Step 2: Multiply C (5×60) and D (60×80): * - This is done by the recursive call minOperations(arr, partition + 1, end). * - The multiplication cost is calculated as: 5×60×80 = 24000. * - The resulting matrix has dimensions 5×80. * * Step 3: Multiply the result of (A×B) (10×5) with the result of (C×D) (5×80): * - The multiplication cost is calculated as: 10×5×80 = 4000. * - This step is handled by the following code: arr[start - 1] * arr[partition] * arr[end]. */ int multiplicationCost = arr[start - 1] * arr[partition] * arr[end] + minOperations(arr, start, partition) + minOperations(arr, partition + 1, end); minimumMultiplicationCost = Math.min(minimumMultiplicationCost, multiplicationCost); } // Return the minimum multiplication cost for the current subproblem. return minimumMultiplicationCost; } } //Better Approach class Solution { private static int[][] cache; static int matrixMultiplication(int arr[]) { cache = new int[arr.length][arr.length]; intializeCache(); return minOperations(arr, 1, arr.length - 1); } private static int minOperations(int arr[], int start, int end) { if (start == end) { return 0; } if (cache[start][end] != -1) { return cache[start][end]; } int minimumMultiplicationCost = Integer.MAX_VALUE; for (int partition = start; partition < end; partition++) { int multiplicationCost = arr[start - 1] * arr[partition] * arr[end] + minOperations(arr, start, partition) + minOperations(arr, partition + 1, end); minimumMultiplicationCost = Math.min(minimumMultiplicationCost, multiplicationCost); } return cache[start][end] = minimumMultiplicationCost; } private static void intializeCache(){ for(int i=0;i
@bishalpandit44642 жыл бұрын
Great video! With great explanation
@manasagarwal9341Ай бұрын
Just one doubt. Cann't be the best answer could be from multiplying non continuous matrices like multiplying matrix A and D , B and C and then [AD] * [BC].
@culeforever54086 ай бұрын
Love you man
@bobbysharma24952 жыл бұрын
Very well Understood , since you were on a vacation, I thought why waste time let's learn MCM from some different guy, Aditya Verma was on the top searches, and OMG the roast..... at 00:37 hahahaha
@tempbot719024 күн бұрын
understood bro!!!
@rishabhbhatt99392 жыл бұрын
sir what will be the exact TC of the recursive approach without memoization.
@takeUforward2 жыл бұрын
You cannot say exact TC of recursion, because it is generically exponenitation in nature as it tries all ways.