Implement prototype(text: str, pattern: str) -> list[int] and solve with the same signature. Return every starting index in ascending order, including overlapping matches. Compare Python string code points exactly; do not casefold or normalize.

Examples: ('ababa', 'aba') returns [0, 2]; ('abc', '') returns [0, 1, 2, 3]. An empty pattern matches every boundary, including the end. A nonempty pattern in empty text returns [].

The prototype tries each start character by character. The final version uses KMP with O(n+m) search/preprocessing time and O(m) auxiliary space, excluding output. No additional errors are required; inputs remain unchanged.

Drag or use the arrow keys to resize. Home collapses the question; End collapses the editor. Enter or double-click resets the split.
Loading editor…
No results yet.

Complete the starter code, then run the checks.
Results and errors will appear here.