• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
November 30, 2023 |480 Views
SDE Sheet - Rabin Karp Algorithm
  Share  1 Like
Description
Discussion

This video is part of the Strings section under the GFG SDE Sheet.

In this problem, we are given two strings, one is a text string and the other is a pattern string. The task is to print the indexes of all the occurrences of the pattern string in the text string. For printing, the Starting Index of a string should be taken as 1.

Example :

Input:
S = "batmanandrobinarebat", pat = "bat"
Output: 1 18

Explanation: The string "bat" occurs twice in S, one starts are index 1 and the other at index 18. 

Try it out before watching the implementation of the problem in the video. We recommend watching the video, even if you can solve the problem. You may discover something new. All the best!!!

Do check out:-
Article: https://www.geeksforgeeks.org/rabin-karp-algorithm-for-pattern-searching/
Problem: https://www.geeksforgeeks.org/problems/search-pattern-rabin-karp-algorithm--141631/1
SDE Sheet Link: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/

Read More