일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Protocol
- 315. Count of Smaller Numbers After Self
- LeetCode
- Python
- 43. Multiply Strings
- concurrency
- Class
- 30. Substring with Concatenation of All Words
- kaggle
- 컴퓨터의 구조
- 시바견
- data science
- shiba
- Generator
- 715. Range Module
- t1
- 프로그래머스
- Substring with Concatenation of All Words
- attribute
- 파이썬
- Decorator
- iterator
- DWG
- 밴픽
- Python Implementation
- 운영체제
- Convert Sorted List to Binary Search Tree
- 109. Convert Sorted List to Binary Search Tree
- Regular Expression
- Python Code
Archives
- Today
- Total
Scribbling
LeetCode: 77. Combinations 본문
class Solution:
def combine(self, n: int, k: int) -> List[List[int]]:
self.ret = []
self.helper([i+1 for i in range(n)], k, [])
return self.ret
def helper(self, nums, k, path):
if k == 0:
self.ret.append(path)
return
for i, num in enumerate(nums):
self.helper(nums[i+1:], k-1, path+[num])
'Computer Science > Coding Test' 카테고리의 다른 글
LeetCode: 78. Subsets (0) | 2021.10.01 |
---|---|
LeetCode: 76. Minimum Window Substring (0) | 2021.09.30 |
LeetCode: 75. Sort Colors (0) | 2021.09.28 |
LeetCode: 74. Search a 2D Matrix (0) | 2021.09.28 |
LeetCode: 73. Set Matrix Zeroes (0) | 2021.09.28 |