Find the Longest Valid Obstacle Course at Each Position
For every index, find the longest non-decreasing obstacle course that ends there. The visual keeps the tails array and shows where each new value lands by binary search.
For every index, find the longest non-decreasing obstacle course that ends there. The visual keeps the tails array and shows where each new value lands by binary search.