Find Beautiful Indices in the Given Array | Part I & II | KMP Algorithm | String Matching Algorithm
Vložit
- čas přidán 9. 07. 2024
- In this video, I'll talk about how to solve Leetcode 3008. Find Beautiful Indices in the Given Array II
3008. Find Beautiful Indices in the Given Array II - leetcode.com/problems/find-be...
3006. Find Beautiful Indices in the Given Array I - leetcode.com/problems/find-be...
KMP CODE: leetcode.com/problems/find-be...
Checkout DSA-169 Series: • Aryan DSA-169 Series |...
100Days 100k Placements: • 100 Days 100K Placement
Let's Connect:
📝Linkedin: / aryan-mittal-0077
📸 Instagram: / ez.pz.dsa
📱Telegram : t.me/aryan_mittal_group
🤖 Github: github.com/aryan-0077
About Me:
I am Aryan Mittal - A Software Engineer in Goldman Sachs, Speaker, Creator & Educator. During my free time, I create programming education content on this channel & also how to use that to grow :)
✨ Timelines✨
0:00 - Problem Explanation + Intuition
5:18 - KMP (Knuth Morris Pratt) Algorithm - Building Up
23:04 - Intuition of KMP working
30:00 - Dry Run of Entire Algo with Code
42:00 - Code Explanation
47:00 - Time Complexity Proof
53:00 - Continue Hard Problem Solving
58:00 - Code Explanation of Hard Problem
✨ Hashtags ✨
#programming #Interviews #leetcode #faang #maang #datastructures #algorithms
The part where you explained the Intuition of KMP working is just out of the world!!
You're just crazy I would say. Just crystal clear understanding of the most complex algorithm of dsa. Your effort = 100/100, understandability=100/100. Grateful towards you =100/100
I figured out why the balloon came, it was because you made a victory sign with your two fingers while explaining.😄
You're just crazy I would say. Just crystal clear understanding of the most complex algorithm of dsa. Your effort = 100/100, understandability=100/100. Grateful towards you =100/100
🙂🙃
BEST VIDEO EVER ON KMP SIR 😍
I have already watched Neetcode video of kmp, but your version of KMP is best.I liked your video bro , thank you.
The number of times you have sent Broo to ask for matching the pattern , now he is not anymore bro he is telling "jaa khud puchkar aa ". Brooooo🤯
finally learned kmp .clean and clear explanation .
thank you so much bro.
bhai ive watched at;east 10 15 videos on lps kmp but could'nt get the intuition for some time i could mug up..but forget after some time...this time i got the proper intuition thanks so much
"I wouldn't have said 'bro' this many times in my entire life as you did in this video alone 😂..But really nice explanation ❤"
nice explanation👍
Thank you for the video.
Understood everything about kmp.
I want to find O(M) space of LPS array i.e. to use only of pattern length. Where to find it?
Best video on kmp Just awesome
btwn z-function and kmp wch one is good?
Good explanation
35:42 iska intution ptaa hai kisiko aisa krne se answer kyu aara?
I couldn't wrap my head around the below line at czcams.com/video/Gr-eKRuWIQc/video.html:
lps[i] = prev_idx + (s[i] == s[prev_idx] ? 1 : 0);
How are you soo sure that if the character at index "i" matches with character at "prev_idx" then we can get the lps of current index by adding "prev_idx" to it ?
I mean I agree that characters at index "i" & "prev_idx" match, but we don't have any idea about what character is at index "i-1" and whether it is in the longest suffix matching the prefix. Without this idea, how can we add "prev_idx" ?
Brooo 🤯
Hi, at the example with s = "aabaacaabaaa" the last lps element should be 2 not 0. Am I wrong? In my opinion should be like lps = [0, 1, 0, 1, 2, 0, 1, 2, 3, 4, 5, 2] and not [0, 1, 0, 1, 2, 0, 1, 2, 3, 4, 5, 0]. Timestamp: 9:23
Bro, ending character was a ‘d’ and not ‘a’ 🙃, though you are absolutely right, if it would have been ‘a’, lps would have been as you mentioned 🫡
@@ARYANMITTAL Oh I got it, I'm sorry it seemed really an 'a' to me. Thanks for replying.
I am just not getting the intuition behind :
If current character doesnt matches the previousindex character then why should we go to its previous index and repeat same process?
Unable to understand intuition behind that while loop stuff!
I will suggest do Leetcode problem 3036 & 3031 (Write Problem name by Aryan Mittal) you will understand the usecase & importance of this while loop.
If still have a confusion, then have a new comment, don’t reply on this comment as for me, it will not be visible, and tell what point you understood intuition and what point things doesn’t make sense, i’ll try replying there ❤️❤️
KMP Game over thankss aryan bhaiya
only me, jise kuch smjh nhi aaya?
Bhai please don't use "bhaiya" word, i think those who are watching your vedio are not your little brother can be your big brother. It feels bad please don't use it.
Don't watch his videos . We love him calling everyone bhaiya
he's our sweet bhaiya. bhaiya is ageless. Focus on his explanation rather than the pronouns. I am a girl so should I give him a bash for not calling out in girl pronouns?!
You're so ungrateful bro.