Question
Given a string s of lowercase letters (1 <= len(s) <= 3*10^4), return the longest substring that occurs at least twice in s (occurrences may overlap). If no character repeats such that a duplicated substring exists, return the empty string. If several answers of the same maximal length exist, returning any one of them is acceptable, but for these tests return the FIRST (lowest second-occurrence index) found by the standard binary-search-plus-rolling-hash method.
longest_dup_substring(s: str) → str["banana"]out"ana"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.