Question 12

A string s3 consists of multiple repetitions of s1.

Given s1 and another string s2, find if s2 is a substring of s3.

s3 = s1 + s1 + … + s1 = n * s1, where n is a positive integer 0.

For example

s1 = “aabc”, s2 = “caa” => true

s1 = “aabc”, s2 = “cab” => false

s1 = “aabc”, s2 = “caabcaa” =? true

[advanced_iframe securitykey=”undefined” src=”https://code.kodnest.com/” width=”100%” height=”600″]

×