GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — leetcode/python/071_Simplify_Path.py at master · scrz2015/leetcode Expand file tree/ Copy path071_Simplify_Path.pyMore file actions 20 lines (20 loc) · 571 Bytes / Copy path071_Simplify_Path.pyFile metadata and controls20 lines (20 loc) · 571 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 class Solution(object): def simplifyPath(self, path): """ :type path: str :rtype: str """ result = [] plist = path.split('/') for pos in plist: if pos: if pos == '..': try: # up one level result.pop() except: # arrive top level result = [] elif pos != '.': result.append(pos) return '/'+'/'.join(result) |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |