https://leetcode.com/problems/simplify-path/
The canonical path should have the following format:
'/'
.'/'
.'/'
.'.'
or double period '..'
)Return the simplified canonical path.
Example 1:
Input: path = "/home/"
Output: "/home"
Explanation: Note that there is no trailing slash after the last directory name.
Example 2:
Input: path = "/../"
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.
Example 3:
Input: path = "/home//foo/"
Output: "/home/foo"
Explanation: In the canonical path, multiple consecutive slashes are replaced by a single one.
Best Explanation Ever Possible || Not a ClickBait - LeetCode Discuss
先用 / split
之後走訪split後的array
如果 len>0 & i=..