Problem 2901 · Medium

Longest Unequal Adjacent Groups Subsequence II

Chain words whose groups alternate and whose neighbours differ in exactly one letter, keeping the longest chain by a predecessor table.

Open the interactive visualisation