Skip to content

Latest commit

 

History

History
17 lines (12 loc) · 347 Bytes

File metadata and controls

17 lines (12 loc) · 347 Bytes

Problem 1: KMP Pattern Matching

Problem Statement

Implement the Knuth-Morris-Pratt algorithm for pattern matching.

Input Format

  • A text t and pattern p.

Output Format

  • List of starting indices of all occurrences.

Constraints

  • 1 <= len(p) <= len(t) <= 10^5

Example

Input: t="aabaabaa", p="aab"
Output: [0, 3]