Algorithm · Meta · Medium
Create a function that models how Linux handles the cd command. It must support these cases: Navigate to an absolute location, such as moving from / to /a/b/c. Resolve a relative destination; for instance, from /a/b, applying ../c should produce /a/c. Interpret .. as the parent directory and . as the current directory. Function signature: Input Parameters: current_path (string): The directory where navigation begins. target_path (string): The path supplied to the simulated…
Checking your access…