← Google questions
CodingReported in a candidate post, Sep 2024

Find all matches of a small string in a big string

Filed under Google

Given a text string and a smaller pattern string, return the start indices of all occurrences of the pattern in the text, including overlapping ones. Explain why your algorithm is linear.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Google questions

Collected from public candidate posts and coding forums. Updated Nov 2026.