Problem description
Given an absolute path for a file (Unix-style), simplify it.
Examples
1 | Example 1: |
1 | Example 2: |
1 | Example 3: |
Solution
边界情况考虑好,当为/../,即已经访问到根目录时,再往前是无法访问的。返回“/”
Code
1 | class Solution { |
1 | Example 1: |
1 | Example 2: |
1 | Example 3: |
边界情况考虑好,当为/../,即已经访问到根目录时,再往前是无法访问的。返回“/”
1 | class Solution { |
本文标题:Simplify path
文章作者:Night
发布时间:2018-12-30, 00:00:00
最后更新:2022-02-03, 17:52:51
原始链接:http://yoursite.com/2018/12/30/Simplify%20path/
许可协议: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。