Code Room
CodingMediumcod-g1396
Subject StringsLevel Entry–Mid~16 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

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) → bool
Examples
in["abab"]outtrue
What 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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.