Problem 3288 · Hard
Memoize the longest chain rising from and falling to a fixed point, then join them at that point.
Open the interactive visualisation