일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 315. Count of Smaller Numbers After Self
- 43. Multiply Strings
- 시바견
- Protocol
- Decorator
- iterator
- 715. Range Module
- Substring with Concatenation of All Words
- 30. Substring with Concatenation of All Words
- kaggle
- Regular Expression
- LeetCode
- Class
- 109. Convert Sorted List to Binary Search Tree
- attribute
- 컴퓨터의 구조
- shiba
- 프로그래머스
- data science
- 파이썬
- Generator
- Python Code
- 운영체제
- Python
- concurrency
- Python Implementation
- 밴픽
- DWG
- Convert Sorted List to Binary Search Tree
- t1
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