← Google questions

Minimum repetitions for substring

Filed under Google

Given two strings A and B, return the minimum number of times A must be repeated such that B is a substring of the repeated string. If it is impossible for B to be a substring, return -1.

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.