Algorithm · Meta · Medium
Problem Given an absolute Unix-style file path path and a current working directory cwd, produce the path in simplified canonical form by eliminating unnecessary . components, .. components, and repeated slashes. The path rules are: A single . refers to the current directory. .. refers to the parent directory. Any run of consecutive slashes, such as // or ///, acts as one slash. Other sequences of periods, including ... and ...., are ordinary directory or file names. The…
Checking your access…