Repeated substring pattern
Detect whether a non-empty lowercase string can be built by repeating one of its substrings two or more times. Return True if such a building block exists, False otherwise. For example, 'abab' is 'ab' repeated twice and 'abcabcabc' is 'abc' repeated three times, but 'aba' and 'abcab' cannot be built this way.
Implement
has_repeated_pattern(s: str) → boolExamples
in
["abab"]outtrueWhat a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 16 min
solution.py
InputExpectedGot
["abab"]truenot run yetsample