~/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.

Stateful stores

In-memory file system

Path hierarchy as nested dicts; quotas.

Notes

Recognise it when: the OA-style "file storage / file system" problem: paths, sizes, users, quotas, backups.

  • A flat dict name -> (size, owner) is often enough. Use nested dicts only if you need directory listings.
  • Keep a used counter per user (update it on every add, delete and merge) rather than recomputing it.
  • "Top n by size, then name": sorted(..., key=lambda x: (-size, name))[:n].

Gotchas: every mutation path (delete, merge, restore) must keep the capacity counters consistent. Test that after each level.

4 problems

Practical systems

Stateful stores Key-value stores, file systems, banks, with history.

In-memory file system

esc