Simplify Path
Input: "
/home/"
Output: "
/home"
Explanation:
Note that there is no trailing slash after the last directory name.Input: "
/../"
Output: "
/"
Explanation:
Going one level up from the root directory is a no-op, as the root level is the highest level you can go.Solution & Analysis
Stack + String Split + String Concatenation
Last updated