Problem 3598 · Medium

Longest Common Prefix Between Adjacent Strings After Removals

Precompute the prefix lengths of neighbouring words, then each removal only changes one new adjacent pair, found with prefix and suffix maxima.

Open the interactive visualisation