~/boss / rune-scrolls

Longest common subsequence (dynamic programming)

The Ancient Scrolls

Find the most runes both scrolls share, in order. Fill the table, then trace them back.

Loading the fight…

How to beat it

One scroll down the side, one across the top. Same rune? Take the diagonal cell + 1. Different runes? Take the bigger of the cell above and the cell to the left. The bottom-right corner is the length; walk back from it to read the runes.

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-common-subsequence there. Sign in with your email to keep your progress on every device.

More bosses

esc