Shortest repeating motif
A sign controller paints a banner into a strip of cells by writing one motif into the strip over and over. Each write lays the motif down at a cell offset the controller picks. Writes may overlap as long as the overlapping cells agree, no write may run past either end of the strip, and every cell must be written at least once. Given the finished banner, return the length of the shortest motif that could have produced it. Every banner is produced by writing itself once, so the answer never exceeds the banner length. The empty banner needs no writes at all, so return 0. Overlap is the point: ababa comes from writing aba at offsets 0 and 2, so its answer is 3 even though ababa is not built by laying whole copies end to end.
shortest_cover_len(banner: str) → int["ababa"]out3["aabaa"]out5["abcabcabc"]out3State 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.
["ababa"]3not run yetsample["aabaa"]5not run yetsample["abcabcabc"]3not run yetsample