2 KMP Algorithm | String Matching

preview_player
Показать описание

Given two strings, one is a text string txt and the other is a pattern string pat. The task is to print the indexes of all the occurrences of the pattern string in the text string. Use 0-based indexing while returning the indices.
Note: Return an empty list in case of no occurrences of pattern.

Examples :

Input: txt = "abcab", pat = "ab"
Output: [0, 3]
Explanation: The string "ab" occurs twice in txt, one starts at index 0 and the other at index 3.
Input: txt = "abesdu", pat = "edu"
Output: []
Explanation: There's no substring "edu" present in txt.

------------------------------------------------------------------------------------------
Here are some of the gears that I use almost everyday:

PS: While having good gears help you perform efficiently, don’t get under the impression that they will make you successful without any hard work.
Рекомендации по теме
Комментарии
Автор

big fan of your channel. just noticed a month ago. you have really good videos and you have explained so well. I was surprised that you have 270k subscribers already and just got to know your channel now. amazing work sir, you explain so well!!

pannerbiryani
Автор

I will add the answers of these 3 questions in coming video!

TheAnmolPunetha
Автор

Bhaiya please complete the Graph series. 🙏

drydates
Автор

pat1="ABCABCABABD"
LPS=[0, 0, 0, 1, 2, 3, 1, 2, 1, 2, 0]

pat2="ABAAAA"
LPS=[0, 0, 1, 1, 1, 1]

pat3="AAAA"
LPS=[0, 1, 1, 2]

sumitkumar-ujmk
Автор

I have a suggestion for you If You are using English to explain concept then use English only But if you are using hindi then use hindi to explain concept, Mixing together would be difficult for us to coporate i.

proccccccccc