Ctrl K

Whole Copies of a Block

Easy
Wallpaper is printed by repeating one fragment of a pattern back to back. The pattern is given as a string line. Decide whether line can be built by taking some substring of it and writing it out **two or more** times in a row. Return True if it can and False otherwise.
Example 1
line='xyzxyz' → True

The string is the block "xyz" written twice.

Example 2
line='xyzxy' → False

The length 5 is divisible only by 1 and 5, and the string is not a single repeated letter, so no block fits.

Example 3
line='q' → False

At least two copies are required, and a single letter is only one copy of itself.

Constraints
  • 1 ≤ line.length ≤ 10⁴
  • line consists of lowercase English letters only
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsWhere the Fragment Starts EasyMatch After Shifts EasyWords Hidden in Others EasyFirst Word With a Given Beginning EasyLongest Back-to-Back Run Easy
loading Python…
Input
line='xyzxyz'
Expected
True

Run checks the first 3 tests in your browser. Submit checks all 90 tests on the server, hidden ones included.