~/problems
Problems
Basics first, then the classics, then company-style assessments. Every problem has tests you run right here; multi-level ones unlock as you go. See the roadmap.
Stack: path parsing
Resolve ., .. and symlinks with a stack.
Main path: 8 problems, about 4 hours.
Notes
Recognise it when: path normalization, nested structures, undo, "most recent unmatched".
parts = [] if path.startswith("/") else cwd_parts[:]
for comp in path.split("/"):
if comp in ("", "."): continue
if comp == "..":
if parts: parts.pop()
else:
parts.append(comp)
return "/" + "/".join(parts)
Symlinks: after each append, if the built path is a link, replace the whole stack with the resolved target (relative to the link's parent). Keep an "expanding" set to catch loops.
8 problems
Interview roadmap
Stacks Matching brackets, paths, next greater element.
Stack: path parsing guide
- Play first: The Mole King 1-minute game Stack (simplify a path)
- Current folder after each move basics py · c++ · java easy
- Where each piece of text lives py · c++ · java easy
- Simplify Path code the boss py · c++ · java medium
- CPU usage analysis Uber py · c++ · java medium
- Longest valid ranked-bracket substring Uber py · c++ · java hard
- Fewest deletions to balance parentheses assessment 2 levels DoorDash py · c++ · java easy
- Stack trace reconstruction assessment 3 levels Anthropic py · c++ · java medium
- Cd with ~ and symlinks assessment 3 levels OpenAI py · c++ · java hard