【9月打卡~Leetcode每日一题】77. 组合(难度:中等)
发布日期:2021-05-04 14:00:26 浏览次数:19 分类:技术文章

本文共 161 字,大约阅读时间需要 1 分钟。

77. 组合

在这里插入图片描述
Python使用itertools库一行代码

class Solution:    def combine(self, n: int, k: int) -> List[List[int]]:        return list(itertools.combinations(range(1,n+1),k))
上一篇:【9月打卡~Leetcode每日一题】39. 组合总和(难度:中等)
下一篇:【9月打卡~Leetcode每日一题】347. 前 K 个高频元素(难度:中等)

发表评论

最新留言

做的很好,不错不错
[***.243.131.199]2025年03月13日 16时09分07秒