~/boss / solitaire
The Rising Chain
Deal the monsters into piles like solitaire. The piles count the longest rising chain.
Loading the fight…
How to beat it
Deal the monsters one by one. Each goes on the leftmost pile whose top is stronger or equal; if no pile works, start a new pile on the right. The tops rise left to right, so binary search finds the pile. The number of piles is the length of the longest chain, and a pointer to the pile on the left recovers the chain itself.
Now the real boss
Interviews ask for the code. Watch it run, then write it yourself, tested in Python, C++ or Java.
On your phone? Writing code is easier on a laptop: open bossfight.dev/problems/longest-increasing-subsequence there. Sign in with your email to keep your progress on every device.