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