31 Sequence Pattern Matching

  • 🎬 Video
  • ℹ️ Description
preview_player
UC5WO7o71wvxMxEtLRkPhiQQ



💬 Comments
Author

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

Author

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

Author

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

Author

Leetcode (EASY):

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

Author — Suraj Kumar

Author

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

Author

on leetcode this problem is called "is Subsequence"

Author — Rasen Shuriken

Author

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

Author — abhishek babbar

Author

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

Author

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

Author

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)

Author — ARIF WAQAS

Author

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

Author — Aakash Yadav

Author

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

Author

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

Author

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

Author — Sagar Khurana

Author

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

Author

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

Author — Umber

Author

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

Author — Sayantani Guha

Author

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

Author

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

Author — Jagrit Bhupal

Author

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