Overlapping occurrences
Input
find_all("aaaa", "aa")
Output
[0, 1, 2]
Overlapping matches are included: 'aa' at positions 0,1,2.
Full lesson preview
Return all starting indices where a substring appears in a string (allowing overlapping matches).
Problem statement
Task
Examples
Input
find_all("aaaa", "aa")
Output
[0, 1, 2]
Overlapping matches are included: 'aa' at positions 0,1,2.
Input format
Output format
Constraints
Samples
Input
find_all("abracadabra", "abra")
Output
[0, 7]
Two non-overlapping occurrences at positions 0 and 7.