Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- def simplifyPath(self, path: str) -> str:
- st=[]
- for token in path.split('/'):
- if token=='.' or token=='':
- continue
- elif token=='..':
- if st:st.pop()
- else:
- st.append(token)
- return '/'+'/'.join(st)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement