Problem 2246 · Hard

Longest Path With Different Adjacent Characters

Each node keeps its two longest downward chains that avoid equal neighbors, and a path through the node joins them.

Open the interactive visualisation