Amazon | Phone Screen | Absolute and Relative File Paths

Given an absolute file path and a relative file path as inputs, write a function to determine the working directory after performing a cd command with the relative path as its argument.

e.g.

inputs:
absolute path: "/bin/etc/abc"
relative path: "/../xyz/tuv/../"

output:
"/bin/etc/xyz"

Comments (4)