Minimum Time to Revert Word to Initial State | Part I | Part II | KMP | Leetcode 3029 | 3031

  Рет қаралды 2,765

codestorywithMIK

codestorywithMIK

Күн бұрын

Пікірлер: 32
@anshulsharma3137
@anshulsharma3137 9 ай бұрын
this is more easier to solve with Z function because you can check at every interval of k, if the value in z array is equal to length of suffix then we can simply stop there. please make one video on Z function as well
@DevOpskagyaan
@DevOpskagyaan 9 ай бұрын
Superb explanation
@anshulsharma3137
@anshulsharma3137 9 ай бұрын
I can see a new striver in the making ❤
@bhuppidhamii
@bhuppidhamii 9 ай бұрын
It's mik in the making
@aws_handles
@aws_handles 9 ай бұрын
Legend in the making 🔥
@anushkathakur6531
@anushkathakur6531 9 ай бұрын
I would say better than striver
@souravjoshi2293
@souravjoshi2293 9 ай бұрын
It's Legend MIK in the making
@gui-codes
@gui-codes 7 ай бұрын
It's a new LEGEND in the making.
@thekindspill
@thekindspill 9 ай бұрын
Thanks a lot. was waiting for your explanation for this video.
@AyushDahiya-et6cc
@AyushDahiya-et6cc 5 ай бұрын
BDIYAA
@nileshdeshmukh7841
@nileshdeshmukh7841 9 ай бұрын
Thankyou so much for this video!
@its_me_hb
@its_me_hb 9 ай бұрын
Awesome Man
@harsh2518
@harsh2518 2 ай бұрын
bhai please videos me timestamps lga diya kro thoda helpful hota hai baki explanation is very good.
@codestorywithMIK
@codestorywithMIK 2 ай бұрын
Sure ❤️
@AshuAnu-ec9ko
@AshuAnu-ec9ko 5 ай бұрын
sir try to upload videos of rabin karp and z algorithm
@tutuimam3381
@tutuimam3381 9 ай бұрын
Thanks a lot
@theOmKumar
@theOmKumar 9 ай бұрын
I could only come up with (n- lps)/k and submitted wrong answer😅, thank you for the detailed explanation.
@codestorywithMIK
@codestorywithMIK 9 ай бұрын
Trust me, you came up with (n-lps)/k That’s commendable 👌👌
@theOmKumar
@theOmKumar 9 ай бұрын
@@codestorywithMIK thank you bhaiya 🙏 learning from you!
@DevOpskagyaan
@DevOpskagyaan 9 ай бұрын
I could only solve 1st qn in the contest 😢 But I will try my best
@23cash86
@23cash86 9 ай бұрын
Thankssd
@Strawcontamination
@Strawcontamination 9 ай бұрын
please make a video on how to use comparator and lambda in c++ and also in java
@HimanshuVarshney-z7e
@HimanshuVarshney-z7e 5 ай бұрын
bhaiya aaj ke leetcode ke contest ka 4th question ka bhi video bna do na ....aapki wajaah se meri leetcode ki rating 1812 ho gyi hi and bdh bhi rhi hai ...thanks a lot bhaiya ...
@navdeepdhama403
@navdeepdhama403 2 ай бұрын
I am not able to understand why he use substring from i to n-1 it should be from i to n-1 as we have not appended the k length to original string end
@ektuhaso
@ektuhaso 9 ай бұрын
Thank you so much sir ❤️ Leetcode 3025 3026 and leetcode 3027 please sir i request you
@Ramneet04
@Ramneet04 9 ай бұрын
Bhaiya biweekly too please 🙏 2nd and 4th
@rdxrdx1792
@rdxrdx1792 6 ай бұрын
Ipad notes of this video
@prakhargarg4166
@prakhargarg4166 9 ай бұрын
Please add timestamps
@codestorywithMIK
@codestorywithMIK 9 ай бұрын
Sure ❤️
@anushkathakur6531
@anushkathakur6531 9 ай бұрын
Bhaiya, len=LPS[len-1]; is getting accepted but here len-- is giving wrong answer....but why?
@devanshverma8050
@devanshverma8050 9 ай бұрын
vector computeLPS(string &pat) { /*lps computation */ } int minimumTimeToInitialState(string word, int k) { vector lps=computeLPS(word); int suffLen=lps.back(); int n=word.size(); while(suffLen && (n-suffLen)%k) suffLen=lps[suffLen-1]; if((n-suffLen)%k==0) return (n-suffLen)/k; return ceil(n/(double)k); } if we tried to do suffLen-- instead of suffLen=lps[suffLen-1]. If we did suffLen-- directly then we might not reach the end of the prefix by which our suffix was matching, then there might be the case that by decrementing the suffLen by 1 (n-suffLen)%k==0 hence breaking the loop. so there won't be any successful comparison. for better understanding u can the dry run of the test case: word="baba" k=3
@dayashankarlakhotia4943
@dayashankarlakhotia4943 9 ай бұрын
public int minimumTimeToInitialState(String word,int k){ int n=word.length,j=0,len[]=new int[n]; for(int i=1;i0){ j=len[j-1]; } return (n-j+k-1)/k; } }
Custom Sort String | 2 Approaches | Intuition | Meta | Leetcode 791
28:33
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 32 МЛН
Симбу закрыли дома?! 🔒 #симба #симбочка #арти
00:41
Симбочка Пимпочка
Рет қаралды 5 МЛН
Players push long pins through a cardboard box attempting to pop the balloon!
00:31
Pointers in C / C++ [Full Course]
3:47:23
freeCodeCamp.org
Рет қаралды 4,5 МЛН
UI/UX Course | UI/UX Free Course | UI/UX Training | Intellipaat
3:34:54
C Programming Tutorial for Beginners
3:46:13
freeCodeCamp.org
Рет қаралды 14 МЛН
⚡️NEWS | RUBLE COLLAPSE | STRIKE ON CRIMEA | PUTIN IN KAZAKHSTAN
10:34
Ходорковский LIVE
Рет қаралды 202 М.
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
ThePrimeTime
Рет қаралды 740 М.