Concept Chamka ki nahi? Before Jumping to the solution, ek baar 15-20 minute baith ke, khud solve karne ki koshish karna, it will become easy for you. at 1:00:53 pre =2, so it must be at index 2 not at 4, just small correction at last
@akashkewat1219 Жыл бұрын
Yes bhaiya , concepts shined like a diamond💎
@kartik5134 Жыл бұрын
chamak gaya bhaiya
@NajmGameplay Жыл бұрын
you are the one bro
@AayushDubey_007 Жыл бұрын
Chamka 🤩
@sauravrajpoot6518 Жыл бұрын
Yess 🎉
@manish_kumar_iitg6 ай бұрын
4:45 Brute Force Approach :- int n = s.length(); int maxLen = 0; // Iterate over the length of the prefix and suffix for (int len = 1; len < n; ++len) { string prefix; for(int i = 0; i< len; i++){ prefix.push_back(s[i]); } string suffix; for(int i = n-len; i < n; i++){ suffix.push_back(s[i]); } if (prefix == suffix) { maxLen = len; } } return maxLen;
@abhinandantiwari99443 ай бұрын
❤
@manpatel915711 ай бұрын
Bhaiya mza hi aa gaya... I've seen 4-5 videos for this topic, but unable to understand. Lekin jab aapka video dekha to sab chamak gaya...🤩🙏
@manoharmanu924011 ай бұрын
The way you picked up the right examples to explain the tricky part is commendable. Great going brother👏👏
@divyanshsharma673 Жыл бұрын
I couldn't understand this algorithm at first when I watched, but after some time, when I'm back again... its fixed in my head. Thank you sir !
@priyaanshusoniАй бұрын
The best & most underrated DSA course on KZbin far better than Paid courses out there in the market ! THANK YOU
@nownow102510 ай бұрын
you are very hardworking bhaiya. can be seen clearly from your intial submissions.Thank you for teaching us.grateful to u
@varunprajapati58389 күн бұрын
shukriya mere bhai. Mushkil tha concept, behadh asaan bana diya bhai tumne. Bhhout shukriya😊😊🙏🙏
@kodurisaivishnu49162 ай бұрын
one and only the best Explanation on youtube...
@prajitbanerjee82265 ай бұрын
Your understanding is crystal clear thats why you are able to explain this flawlessly..hats off to your dedication!!!
@GaneshBhutekar-nu1gd3 ай бұрын
lecture is 1 hour, but I spent 4 hours. Then I cleared the concept of LPS. Thank you, sir.
@alijuttjut83802 ай бұрын
but i spent 7hrs with notes
@prabinaswain326711 ай бұрын
After seeing a lot video of KMT , This video gives crystal clear concept how and why we are able to reduce the Time complexity of finding prefix=suffix
@MO-fg2cm Жыл бұрын
9:10 space complexity is O(2N) same as O(N)
@rishabhshenoy32587 ай бұрын
But bro string ka array so o N2 na??
@joydeep-halder12 күн бұрын
7:30 Time complexity to get all prefixes or suffixes will be O(n) instead of O(n^2) bhaiya. To compare all the strings it will take O(n * n). So, at the end, overall time complexity is O(n^2)
@saketjaiswalSJ8 ай бұрын
bhai bahut baar dekha loop mein samjh aaa gya explanation god level bhai really god level
@Playlist-y1f21 күн бұрын
Wohoo!!!!!! amazing explanation.
@ayushsinha169612 күн бұрын
Crazy video. Had to try a lot of examples to understand it clearly. thanks for the awesome explaination
@Roman_Baloch24 күн бұрын
Ak dum chamak gya . Love your teaching method . LOVE FROM PAKISTAN
@nitinkumar5974Ай бұрын
God level explanation...understood everything!
@nitinkumar5974Ай бұрын
have subscribed you, next level explanation. This is a single precious video on whole youtube for KMP right now when I am watching this. Worth watching this 1 hour long video. had watched it at 1.5x speed.
@janaSdj2 ай бұрын
Finally understand LPS after wasting so many times in other garbage videos. Thank you bro...
@engineershbАй бұрын
best bhai best kmal ho qsm sy
@pranavarora724Ай бұрын
Was struggling how to build prefix table Best video so far on building prefix table and KMP algo
@riyaraj57205 ай бұрын
Awesome explanation sir! So much better than any paid course. Thank you thank you thank you!!!
@i_am_groot378723 күн бұрын
best video on yt .. best explaination
@MohitG77013 ай бұрын
very good explanation of such a complex logic. Nowhere find this kind of explanation. Thanks for making this video. 🙏
@neerajchopra2758 Жыл бұрын
no one beat rohit sir 🔥
@_abhi2003_7 ай бұрын
Literally one of the best lecture bhaiya...aLWAYS get motivated by seeing u
@pankajkashyap28926 ай бұрын
chamka diya bhaiya best dsa course in history ever for logic building
@apurvapat3524Ай бұрын
Best Explanation i have ever seen. Hats off
@vivekpaliwal1876Ай бұрын
Time liya but ache se smjha diya..also every line of code is understood thanks
@Niki_00117 ай бұрын
I don't know why college teachers don't teach these questions in this way. You are great, Bhaiya. Love from Uttarakhand ❤️
@vikassinghbisht730511 ай бұрын
Pahadi always rocks ❤
@AkshitChaudhary-vx8iwАй бұрын
Mst padhaya hai. hard transform to Easy : )
@BhaveshJaiswal_o74 ай бұрын
really a great teacher ,means leagend god level bhai
@Devil-ze9kc6 ай бұрын
Maja aa gya bhai ... Seriously enjoyed the way you revealed the suspense of LPS wala technique
@himanshukumar974 ай бұрын
Best explanation ❤ KMP done ✅
@rajendertanwar18815 ай бұрын
Best explanation ❤ after watching whole video, i assure you (viewers) that you're at right place ✅️
@davidsharma966210 ай бұрын
Bro you just nailed it!🔥
@prakashnandan733711 ай бұрын
at 1:00:53 pre ==2, so it must be at index 2 not at 4
@CoderArmy911 ай бұрын
right, thanks
@PrashantKumar-gy1qs Жыл бұрын
Hats off to you sir your content is best.
@rocketgamerzz.7577Ай бұрын
Brute force ko hum O(N) mein bhi toh kr sakte hain ? agr ek temp string le lein and saare prefixk nikalne k liye iterate over the string , temp mein push_back a character and push_back temp into a vector of string every time , saare prefix aa gaye ,and similary O(n) mien saare suffix nikal sakte hain and then at the end bas saare saare same index waale sting in in pre array and suff array ko compare krna hai ,which is O(n^2).
@atifmalik80122 ай бұрын
4:53 //Brute force approach //pass all the test cases but time complexity is O(n²) class Solution { public: int lps(string str) { if(str.size()==1) return 0; int start=0,end=1; while(end
@yashsawalkar6463 ай бұрын
Understood all. For the viewers you have to give it a brief thought and dry run it in mid so that it becomes intuitive
@musaifbangi8705Ай бұрын
People who read "string matching" from cormen book would know how easy is kmp algorithm 😅
@mydiary60233 ай бұрын
sir nice explanation aikdum aaram se samajh aaya
@Pixelofficialmohit24 күн бұрын
Next level content ❤
@Aman_Panchal2711 ай бұрын
Easy to understand than other tutorials and blogs also.
@vidyansh38132 ай бұрын
bhaiya at 30:42 why 3 aise toh piche jo hmne 5 th index pe 0 likha vahan toh 2 likh skte the \
@musaifbangi870524 күн бұрын
Kmp is use for string matching that is to find a string s1 is part of s2 or not
@manikgoyal802611 ай бұрын
thank you bhaiya, after struggling too much for kmp, today I got the clarity
@sarojkumar-wb7tk7 ай бұрын
best explanation 🤩
@AmanKesari-d6e2 ай бұрын
Too good bhaiya.
@vanshikasoni69506 ай бұрын
Space Complexity of brute force is O(2N) ~ O(N)
@tusharnanda3885 Жыл бұрын
at 1:01:11 it should be index = 2 ???
@fachoyt9686 Жыл бұрын
Yes.
@joydeep-halder Жыл бұрын
9:05 Space complexity will be O(n^2) because every element of prefix or suffix array will have kind of n length.
@subhojit627 Жыл бұрын
I think the space complexity will be O(n)
@Sony_47 Жыл бұрын
i am also think its o(n), because in space n+n = n.
@joydeep-halder Жыл бұрын
My thought process behind O(n²) is that, for suffix, the string length will be like 1,2,3,4...n-1 and for prefix also it will be array of strings of length 1,2,3,4..n-1 So basically if we join two arrays string as compliment like from array1 we take string of length 1, and from array2 we take string n-1. Then from array1 we take 2, and from array2 n-2 and like so. Thus both array will compliment each other and will create an array of n strings and each string will have n length. So it will become basically O(n²)
@NajmGameplay Жыл бұрын
u r gae@@joydeep-halder
@Algorithmswithsubham Жыл бұрын
2n? hoga kya
@karankumar3983 Жыл бұрын
24:39 to 27:05 49:22 to 54:30 conclusion of whole LPS concept
@sarveshpawaskar53633 ай бұрын
Thank you Rohit sir/bhaiyya.....❤
@motivationalmajakkhel5 ай бұрын
Hello bhaiya, brute force approach to check for longest prefix and suffix int maxi = 0; int first = 0, last = s.size()-1; string one=""; string two=""; while(first0){ one+=s[first]; two=s[last]+two; if(one == two){ maxi = one.size(); } first++; last--; }
@abhinavparashar19346 ай бұрын
Corrected code of Longest prefix suffix Method : Longest prefix suffix Code start from here #include #include using namespace std; int main() { string s; cout
@killflag9850Ай бұрын
Starting mee meri bhat ke char hoo gayi yar 😂
@musaifbangi870524 күн бұрын
1:00:30 the index is 2 not 4
@MaheshPatil-of1zy3 ай бұрын
Imagine If One Can Discover KMP in the interview itself to solve, Just GOD LEVEL🥶🥶🥶
@janaSdj2 ай бұрын
Not possible
@janaSdj2 ай бұрын
Too hard to figure it out....
@fachoyt9686 Жыл бұрын
Great Lecture.
@isroindia96482 ай бұрын
My code for brute force approach at 4:40 text = "ABCDEABCD" #prefix array list1=[] for i in range(len(text)-1): if len(list1)==0: list1.append(text[i]) else: res=list1[i-1]+text[i] list1.append(res) for i in list1: print(i) #suffix array list2=[] j=len(text)-1 while j>0: if len(list2)==0: list2.append(text[j]) else: res=text[j]+list2[-1] list2.append(res) j-=1 for i in list2: print(i) # calculating longest prefix suffix max_length=0 for prefix in list1: if prefix in list2: length=len(prefix) max_length=max(max_length,length) print(max_length)
@snehaprasad83 ай бұрын
GREAT EXPLANATION🤩
@Priceful_peace2 ай бұрын
Time complexity O(2n-2) for brute force ?
@akhileshbhagat6721 Жыл бұрын
hardest hardest kh kr asani se samjha dia wah
@saitanush94536 ай бұрын
Tq bhaiya, aaj kuch naya seekha😄😄
@priyanshasharma44433 ай бұрын
you made this topic easy thanks
@SamirKumarRakshit-c4z4 ай бұрын
Brute force in python: word = "ABGHCABGH" prefix = [] ans = "" for i in range(8): ans += word[i] prefix.append(ans) suffix = [] anss = "" for i in range(1, 9): anss = word[-i]+anss suffix.append(anss) for index in range(len(prefix)): if(prefix[index] == suffix[index]): print (prefix[index])
@rishabhshenoy32587 ай бұрын
9:11 On2 hogi kyunki ham string ka array banayege jo string is a type of array , so 2d array jesa kaam hoga
@heetpatel303710 ай бұрын
Aapki jitni tarif kare utni kam hai ❤
@myyoutubeisthis7 ай бұрын
Thank you sur for this amazing explanation
@nitinduke Жыл бұрын
bhot ache se samjh aagya bhaiya
@JitCodeHub.10 ай бұрын
KMP Stands For????????????????
@Vaibhavvashishtha1239 ай бұрын
Knuth morris pratt
@shrivvlogs6045 Жыл бұрын
Love u bhiya ❤️
@AlphaJava-q6j Жыл бұрын
Sach me bhaiya tussi great ho 🎉🎉❤❤❤ kal ke DAA ke exam me fod ke aunga🎉❤
@pratik.784 Жыл бұрын
bhot badhiya samjhaya
@shivnathsinghgaur59729 сағат бұрын
HA G Bhiya Chamka . Thank you
@piyushsinghdtu4565 ай бұрын
thanks sir
@akashkewat1219 Жыл бұрын
Done todays lecture thank Bhaiya😊
@kaushalshinde811 ай бұрын
best explaination..
@YashSaini007 Жыл бұрын
Bhaiya Radhe Radhe 🙏
@khushisingh-hb9kq Жыл бұрын
Great explanation
@joydeep-halder Жыл бұрын
Good morning bhaiya ❤❤
@heetpatel303710 ай бұрын
Chamka bhaiya chamka 👍🏻
@vipulkumar183011 ай бұрын
chamak gya bhaiya ek dam
@bharatmehta30 Жыл бұрын
Thanks bhaiya. chamak gya
@ankushladani496 Жыл бұрын
Thanks Bhaiya...❤🎉
@Sony_47 Жыл бұрын
bhaiya i think , 52:00 me D me LPS ki value 2 hogi . ky mai galat hu?
@Ajeetkumar-uo4hf Жыл бұрын
Rohit bhai median of two sorted array (Binary Search) wala question pe video bana do . Avi tak 10 video dekh chuka hu youtube par but samjh nhi aa rha hai pls expain🙏
@rashisahu8511 Жыл бұрын
Amazing explanation
@AMITKUMAR-ds4hp Жыл бұрын
Good morning boss ❤
@joydeep-halder Жыл бұрын
Bhaiya mai exact algorithm nhi bana paya, lekin mai soch rha tha ki humlog is fact ko use ker sakte hai kya ki mid se start kare dhundna. then vo initial search space thora kam ho jayega. 🤔🤔