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.
Corner Cases:"/../"
?"/"
.'/'
together,
such as "/home//foo/"
."/home/foo"
.
public class Solution { public String simplifyPath(String path) { Stackstack = new Stack<>(); for(int i=0;i