~/boss / spell-groups

Hash map (group anagrams)

The Spell Sorter

Same letters, same group. Sort the spell pile without comparing a single pair.

Loading the fight…

How to beat it

Give each word a key: its letters, sorted A to Z. LISTEN and SILENT both become EILNST. Look the key up in a hash map: there's a group for it already? Drop the word in. No group yet? Start one.

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

More bosses

esc