Repeated String Match at Google

Medium38.3% acceptance

This problem has 37.5% frequency at Google.

Problem Description

Given two strings `a` and `b`, return _the minimum number of times you should repeat string_`a` _so that string_ `b` _is a substring of it_. If it is impossible for `b`​​​​​​ to be a substring of `a` after repeating it, return `-1`. **Notice:** string `"abc"` repeated 0 times is `""`, repeated 1 ti...

Read full problem and hints

Topics

Also asked at 5 companies


More Google Questions

View all Google questions