~/boss / mirror-spell
Expand around center
The Mirror Spell
Each spell hides a palindrome. Pick its center, expand, and find the longest.
Loading the fight…
How to beat it
Every palindrome mirrors around a center: a letter (RACECAR) or the gap between two letters (NOON). From each center, expand outward while the two outer letters match; stop at a mismatch or the edge. Keep the longest. About 2n centers, each growing at most n: n² instead of n³ for checking every substring.
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-substring there. Sign in with your email to keep your progress on every device.