~/boss / secret-scroll
Huffman coding
The Secret Scroll
Shrink the scroll from 88 bits to 23. Join the two rarest, again and again.
Loading the fight…
How to beat it
Count each letter: that's its weight. Join the two lightest under a new node that weighs their sum, put it back, and repeat until one tree is left. A letter's code is its path from the top: left is 0, right is 1. Common letters end up near the top with short codes.
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/huffman-coding there. Sign in with your email to keep your progress on every device.