← Back to challenges

Repeated Sub-String Pattern

JavaScriptHardconditionsstringsvalidation

Instructions

Create a solution that checks if a given string consists of a sub-string pattern repeated multiple times to return true or false.

Examples

repeated("a") ➞ false

repeated("ababab") ➞ true

repeated("aba") ➞ false

repeated("abcabcabcabc") ➞ true

repeated("aaxxtaaxztaaxxt") ➞ false

Notes

Adroit programmers can solve this in one line.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.