~/boss / echo-bat

Interval DP

The Echo Bat

Its cry must read the same both ways. Fill the table, shortest pieces first.

Loading the fight…

How to beat it

Each cell is the longest echo hidden in one piece of the word: start at its row's letter, end at its column's. One letter is an echo of 1. For a longer piece, look at its two end letters. They match? Wrap them around the best echo inside: the cell down and to the left, plus 2 (two matching letters side by side wrap around the 0 just below the diagonal). They differ? Drop one end: take the bigger of the cell below and the cell to the left.

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

More bosses

esc