일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- concurrency
- data science
- 컴퓨터의 구조
- Regular Expression
- 밴픽
- 315. Count of Smaller Numbers After Self
- kaggle
- 운영체제
- 파이썬
- attribute
- LeetCode
- Python Code
- Protocol
- DWG
- 30. Substring with Concatenation of All Words
- Generator
- 프로그래머스
- Python
- t1
- Substring with Concatenation of All Words
- Decorator
- Class
- Convert Sorted List to Binary Search Tree
- 109. Convert Sorted List to Binary Search Tree
- 715. Range Module
- 시바견
- shiba
- iterator
- Python Implementation
- 43. Multiply Strings
Archives
- Today
- Total
목록71. Simplify Path (1)
Scribbling
LeetCode: 71. Simplify Path
class Solution: def simplifyPath(self, path: str) -> str: stack = [] paths = path.split('/') for path in paths: if path: if path == '.': continue elif path == '..': if stack: stack.pop() else: stack.append(path) ret = '/' for path in stack: ret += path + '/' if not stack: return ret return ret[:-1]
Computer Science/Coding Test
2021. 9. 26. 17:22