AI Interview Prep is optimized for larger screens
Please open this on a laptop or desktop (1024px and wider) to use the full editor, whiteboard, and AI coaching surface.
Understand the problem
Restate the problem precisely. Interviewers reward candidates who pause, define the contract, and name the guarantees before coding.
Given a string `path`, which is an absolute path (starting with a slash '/') to a file or directory in a Unix-style file system, convert it to the simplified canonical path. In a Unix-style file system, a period '.' refers to the current directory, a double period '..' refers to the directory up a level, and any multiple consecutive slashes (i.e. '//') are treated as a single slash '/'. Any other format of periods such as '...' are treated as file/directory names. The canonical path should: start with a single slash; have directories separated by a single slash; not end with a trailing slash; only contain the directories on the path from the root.
Once you've drafted a response, click Submit for AI review and a senior engineer will critique your reasoning.