← Back
00:00

In-Memory File System

Perplexity interview questions · Hard · Coding round · reported 6× · 6 tests

Implement an in-memory Unix-style file system. The interview reports describe this round as a multi-part extension of the classic trie/tree file-system problem: start with directory creation, file creation, and listing, then add deletion and working-directory navigation.

Interface

class InMemoryFileSystem {
  mkdir(path: string): boolean;
  touch(path: string): boolean;
  ls(path?: string): string[] | null;
  rm(path: string): boolean;
  rmdir(path: string): boolean;
  cd(path: string): string | null;
  pwd(): string;
}

Rules

Idle