← Back
00:00

CD Directory Navigation

OpenAI interview questions · Medium · Coding round · reported 2× · 7 tests

Implement a simplified cd helper for an interview shell. The function starts from a current directory, applies a destination path, and returns the normalized absolute path.

Interface

interface CdOptions {
  homeDir?: string;
  symlinks?: Record<string, string>;
}

resolveCd(cwd: string, target: string, options?: CdOptions): string | null

Rules

Idle