일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Decorator
- 109. Convert Sorted List to Binary Search Tree
- 715. Range Module
- LeetCode
- 프로그래머스
- shiba
- kaggle
- Generator
- t1
- 시바견
- Python
- 밴픽
- Python Implementation
- DWG
- data science
- 315. Count of Smaller Numbers After Self
- Class
- 운영체제
- 파이썬
- Protocol
- iterator
- concurrency
- Regular Expression
- Python Code
- 30. Substring with Concatenation of All Words
- attribute
- Convert Sorted List to Binary Search Tree
- Substring with Concatenation of All Words
- 43. Multiply Strings
- 컴퓨터의 구조
Archives
- Today
- Total
Scribbling
LeetCode: 93. Restore IP Addresses 본문
class Solution:
def restoreIpAddresses(self, s: str) -> List[str]:
self.ret = []
self.nums = set([str(i) for i in range(256)])
self.helper(s, [])
return self.ret
def helper(self, s, ip):
if len(ip) == 4:
if not s:
self.ret.append('.'.join(ip))
return
if not s:
return
for i in range(min(3, len(s))):
if s[:i+1] in self.nums:
self.helper(s[i+1:], ip+[s[:i+1]])
'Computer Science > Coding Test' 카테고리의 다른 글
LeetCode: 92. Reverse Linked List II (0) | 2021.10.12 |
---|---|
LeetCode: 97. Interleaving String (0) | 2021.10.11 |
LeetCode: 91. Decode Ways (0) | 2021.10.11 |
LeetCode: 100. Same Tree (0) | 2021.10.11 |
LeetCode: 90. Subsets II (0) | 2021.10.10 |