Thanks a lot 2 bar dekhne k bad aur leetcode discuss pdhne k bad aakhir smjh m aahi gya
@apurvpandey17 Жыл бұрын
Thank you bhai kya explanation diya ab jaa k samajh mai aaya
@nedames33282 жыл бұрын
Excellent step-by-step explanation. Other speakers don't say why we need the l mod (k-1) logic. I think you could make your presentation even better by explaining that l is the largest index -- not the length. The examples could run from a0, a1, ..., al. That would make it clear that when (l = length - 1) piles compress down to (k-1) piles we need to add the full sum from 0 to l to account for merging the remaining pile with the final k piles. Thanks.
@sheikhmkrifat7749Ай бұрын
to merge k elements we need at least k elements, thats means length should be at least k, then condition should be like L < K , but you you said l < k - 1 thats confusing, and at several point you didnt clarify some equation and some logic, k + k - 1 this i got it, but how its related to came up in (n - 1) % (k - 1) == 0 this equation, in an interview we have to clarify this kind of thing properly.
@mukulvarshney66911 күн бұрын
he is talking length in terms of index lets say length is 1 then he is saying length is 0. I mean L
@sayantaniguha85193 жыл бұрын
Can this also be solved as a variation of matrix chain multiplication ?
@Munnu-hs6rk10 ай бұрын
yes
@divyamthacker24985 ай бұрын
@@Munnu-hs6rk how, can you provide the code
@veganengineer20194 жыл бұрын
typo at 5:38..... it should be (n-k)%(k-1)
@raghavmittal53524 жыл бұрын
(n-1)%(k-1) can also work
@sudeshnaC4 жыл бұрын
n=k+(k-1)+(k-1)+....(k-1) [say for x times] n=k+x*(k-1) n=k+x*(k-1) +1 -1 [Adding +1 and -1] n=1+(x+1)*(k-1) n-1=(x+1)*(k-1) (n-1)%(k-1)= {(x+1)*(k-1)}%(k-1) (n-1)%(k-1)=0
@AbhinayKacham Жыл бұрын
Nice explanation.
@bishakhdutta84272 жыл бұрын
if this was on codeforces what would be the rating? like this is not a typical hard on leetcode. definitely one of the hardest I have solved.
@watchlistsclips31962 жыл бұрын
When k=3 and if we are at len4 ex:i=0, j=3 we can't merge the stones rt as if we merge 3 stones we are left with 2 there is no way we can merge them but you are writing dp[i][j] exists i am not getting this
@kushagrasrivastava86414 жыл бұрын
thanks, explanation could be better but it gave a very nice idea to understand this question so works for me!!
@kushagrasrivastava86414 жыл бұрын
also, could you tell why we are iterating mid as for(mid=x;mid
@learnandgrow4220 Жыл бұрын
@@kushagrasrivastava8641 to ensure that u can reduce the no. of piles or can get minimum no of piles
@pawandeepchor893 жыл бұрын
Awesome video 👏👏
@learnandgrow4220 Жыл бұрын
Amazing vro , Actually I was not getting why mid+=K , why not mid++ , but cleared thanks a lot
@raseshgupta62763 жыл бұрын
Nicest explanation for this problem
@tushargoyaliit5 жыл бұрын
What do u mean by length 0, why r u considering length zero means 1 pile. length k-1 means k piles. What's this?.these are not number of line segements.
@questlove73774 жыл бұрын
@@tushargoyaliit No dude. Length 0 will have to be considered for the sake of dp. Where it means that for l=0, cost is 0 too.
@RiteshYadav-vm9tb3 жыл бұрын
Superb Explanation!!!
@utkarshgupta62582 жыл бұрын
why Greedy is failing??
@meme_engineering45212 жыл бұрын
it's a scam, it always fails
@vaibhavkumargautam11 ай бұрын
@@meme_engineering4521😂😂😂
@RajeevKumar-xz2zr4 жыл бұрын
great explanation nice video!!! but I would recommend to make the smaller video, you seem to repeating few point, expain and move. anyway nice video well done!
Everyone is writing same types of comment Excellent explanation. Stop collecting people to write same type of comment. Poor Audio quality. At 13:07 I didnt understood if (l % (k-1) ==0 ) then sum all of them . What was that ?