Question
A border of a string is a proper prefix that is also a suffix (proper meaning strictly shorter than the whole string). Return the length of the LONGEST border of s. For example "abcabc" has longest border "abc" (length 3), "aaaa" has length 3, and "abcd" has length 0. The empty string has border length 0. The string can be up to 10^5 characters, so aim for linear time.
longest_border(s: str) → int["abcabc"]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.
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.