~/boss / mole-king

Stack (simplify a path)

The Mole King

Follow the path one piece at a time. Dig in, climb up, or stay put.

Loading the fight…

How to beat it

Split the path on slashes and keep the folders on a stack. A name pushes it: dig in. Two dots pop the last folder: climb up, and at the surface there's nothing to pop. One dot or an empty piece changes nothing. Three dots is just a funny folder name. At the end, read the stack from the top down: that's the clean path.

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

More bosses

esc