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 開發常見問題解決
下一篇 網絡字節序與主機字節序