problem:
Given an absolute path for a file (Unix-style), simplify it.
For example,
path = "/home/"
, => "/home"
path = "/a/./b/../../c/"
, => "/c"
click to show corner cases.
"/../"
?"/"
.'/'
together,
such as "/home//foo/"
."/home/foo"
.
thinking:
提示使用stack来做
code:
上一篇 JAVA 开发常见问题解决
下一篇 网络字节序与主机字节序