AO
Back

In-Memory File System

CodingPhone, OnsiteSoftware Engineer, Machine Learning EngineerLast reported July 2026Medium Frequency

Problem Overview

Implement an in-memory Unix-style file system.
Full problem statement
Implement an in-memory Unix-style file system. Reported as a multi-part, hands-on coding round (often described as LeetCode 588 'lightly modified'): Part 1 — mkdir, touch, ls; Part 2 — rm, rmdir; Part 3 — cd. A common variant feeds raw command-line strings ("mkdir /a", "touch /a/f") that you must parse and execute, backed by a tree/trie of nodes with path parsing; one report also lists reading, writing, and searching. Candidates consistently report that the design isn't exotic, but writing it from scratch and debugging one stubborn edge case inside the time box — with little interviewer help — is what fails people.

Follow-up Arc

Interviewers escalate through these phases. The order varies, but most candidates see at least one from each bucket.
Trade-off discussion · 3
Trade-off discussion
A common variant hands you raw command-line strings to parse and execute rather than calling methods directly.
Probes for: mid-problem
Support cd and relative paths, so subsequent commands resolve against a current working directory.
Probes for: after Parts 1-2 pass
Should mkdir behave like 'mkdir' (parent must exist) or 'mkdir -p' (create intermediate directories)?
Probes for: clarifying scope

What Reports Emphasize

Common mistakes: conflating files and directories (ls/rm/rmdir behave differently on each); rmdir silently succeeding on a non-empty directory; path parsing that ignores '.', '..', trailing slashes, or absolute-vs-relative. Approach: build and unit-test the path resolver first so a bug is localized to one small function.

Practice

Open the editor to write a solution against test cases, then return here to compare against the follow-ups.
Open Editor →
Free preview

Every question in the Perplexity catalog gets this depth

What you just read — canonical solution, follow-up arc, what passing candidates actually did — exists for all 4 Perplexity questions, refreshed monthly from new candidate reports.

$49/mo founding price for the first 100 subscribers · $79/mo after · cancel anytime
Perplexity · Coding · Reported 5× across candidate reports