Chunk overlap length
A log shipper reads a file in chunks and deliberately re-sends a little context, so the end of one chunk can repeat the start of the next. Before appending the second chunk the stitcher needs to know how many leading characters to drop. Given two strings tail and head, return the length of the longest string that is both a suffix of tail and a prefix of head. That overlap can be as long as the shorter of the two strings, and it may be the whole of one of them. Return 0 when nothing lines up or when either string is empty. Report the longest overlap, not the first one you happen to find: for tail ababab and head ababcd the answer is 4, not 2.
overlap_join_length(tail: str, head: str) → int["2026-01-31 boot","boot ok"]out4["heartbeat","beat drop"]out4["gpu-fan-rpm","temp-c"]out0State 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.
["2026-01-31 boot","boot ok"]4not run yetsample["heartbeat","beat drop"]4not run yetsample["gpu-fan-rpm","temp-c"]0not run yetsample