pass 211 77 433

This commit is contained in:
2024-06-02 21:23:00 +02:00
parent 75690d88f7
commit 641f712a20
4 changed files with 147 additions and 0 deletions

13
77-240602-pass/main.py Normal file
View File

@@ -0,0 +1,13 @@
class Solution:
def combine(self, n: int, k: int) -> List[List[int]]:
rlt = []
def comb(l, cur, k):
if k == 0:
rlt.append(l)
return
for i in range(cur, n + 1):
tmp_l = l.copy()
tmp_l.append(i)
comb(tmp_l, i + 1, k - 1)
comb([], 1, k)
return rlt