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
@DevOpskagyaan9 ай бұрын
Superb explanation
@anshulsharma31379 ай бұрын
I can see a new striver in the making ❤
@bhuppidhamii9 ай бұрын
It's mik in the making
@aws_handles9 ай бұрын
Legend in the making 🔥
@anushkathakur65319 ай бұрын
I would say better than striver
@souravjoshi22939 ай бұрын
It's Legend MIK in the making
@gui-codes7 ай бұрын
It's a new LEGEND in the making.
@thekindspill9 ай бұрын
Thanks a lot. was waiting for your explanation for this video.
@AyushDahiya-et6cc5 ай бұрын
BDIYAA
@nileshdeshmukh78419 ай бұрын
Thankyou so much for this video!
@its_me_hb9 ай бұрын
Awesome Man
@harsh25182 ай бұрын
bhai please videos me timestamps lga diya kro thoda helpful hota hai baki explanation is very good.
@codestorywithMIK2 ай бұрын
Sure ❤️
@AshuAnu-ec9ko5 ай бұрын
sir try to upload videos of rabin karp and z algorithm
@tutuimam33819 ай бұрын
Thanks a lot
@theOmKumar9 ай бұрын
I could only come up with (n- lps)/k and submitted wrong answer😅, thank you for the detailed explanation.
@codestorywithMIK9 ай бұрын
Trust me, you came up with (n-lps)/k That’s commendable 👌👌
@theOmKumar9 ай бұрын
@@codestorywithMIK thank you bhaiya 🙏 learning from you!
@DevOpskagyaan9 ай бұрын
I could only solve 1st qn in the contest 😢 But I will try my best
@23cash869 ай бұрын
Thankssd
@Strawcontamination9 ай бұрын
please make a video on how to use comparator and lambda in c++ and also in java
@HimanshuVarshney-z7e5 ай бұрын
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 ...
@navdeepdhama4032 ай бұрын
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
@ektuhaso9 ай бұрын
Thank you so much sir ❤️ Leetcode 3025 3026 and leetcode 3027 please sir i request you
@Ramneet049 ай бұрын
Bhaiya biweekly too please 🙏 2nd and 4th
@rdxrdx17926 ай бұрын
Ipad notes of this video
@prakhargarg41669 ай бұрын
Please add timestamps
@codestorywithMIK9 ай бұрын
Sure ❤️
@anushkathakur65319 ай бұрын
Bhaiya, len=LPS[len-1]; is getting accepted but here len-- is giving wrong answer....but why?
@devanshverma80509 ай бұрын
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
@dayashankarlakhotia49439 ай бұрын
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; } }