31 Sequence Pattern Matching

  • 🎬 Video
  • ℹ️ Description

💬 Comments

Wildcard pattern matching is a more suitable candidate for DP than this one, since this can easily by solved using 2 pointer approach.

Author — Aman Saeed


I don't know why I fully watched this videos, I already think the approach within a minute, this is just because you broo.. Thanks soo much, from the bottom of my heart <3

Author — Amit Kumar Singh


for this question, we can take two pointer i and j, i for larger string and j for smaller string
run a loop for bigger string:
if ith char of bigger == jth char of smaller THEN j++
now check if j==size then it is present

This can be done in O(N+M) time complexity instead O(N*M) by LCS

Author — Sanyam Singhal


Leetcode (EASY):

LCS -> O(N*M)
2 Pointers -> O(N+M)

Author — Suraj Kumar


Just a linear traversal in enough I guess to solve it. Maintain two pointers at each string, move one if you find the character in another. Not worth DP, but always good to know multiple ways of solving !

Author — Mayur Bhor


on leetcode this problem is called "is Subsequence"

Author — Rasen Shuriken


Bro, can u tell us more questions on sequence pattern matching?

Author — abhishek babbar


You have built the concepts really nicely man. After following your all previous dp videos now I dont even wait for you to explain the solution, I just read the question take a pause and write the solution myself. But I still watch your video till the end so as to support you :)

Author — Priya Koshta


I love your videos bro I wish we were taught algorithms in a similar way!!. I shared your videos with many friends they all call you GOD. Please try to make videos on other topics also thank you for this.

Author — girish kulkarni


I think this can be done n O(n) complexity using a stack,
reverse the given string and push it into the stack,
Loop through the second string and keep popping if same elements are found.
In the end, if (my_stack.empty()) return true; else return false.

Pls correct me if I am wrong but this would also give O(N)



Salute to people who cracked placements before feb 6, 2020 !

Author — Aakash Yadav


Sir, you doing great work sir thanks from the core of my heart ❤️❣️ sir
And plz upload the complete playlist of dp sir 🙏🙏

Author — Amarjeet yadav


I did not watch the full video because I was able to think of the logic and it is because of your sir. Thanks for this wonderful playlist.

Author — Shrimad Mishra


wow I'm also able to think about the approach before watching the video Thanks Aditya Sir

Author — Sagar Khurana


30 of 50 (60%) done! Others have mentioned a 2 ptr approach, but this LCS approach is also a diff way of thinking.

Author — 0anant0


Excellent videos.Thanks for sharing!!! Really excited to see your subscribers are growing.

Author — Umber


Wildcard pattern matching is the first ever code I encountered whose Recursive solution gives TLE on Leetcode but not on GFG.

Author — Sayantani Guha


Sir cant we do this in linear time complexity by making 2 pointers point start of both strings and then comparing their elements and if a string pointer reaches end we return true or else false

Author — Dipankur Lawaria


Just by understanding the problem statement, LCS approach came to my mind. All thanks to your previous videos.

Author — Jagrit Bhupal


Sir, can't we check character by character and move in "a" only when matched else move in "b" and if matched then move in both? until one ends

Author — Aditya Jain