Files
2020-08-07 17:06:53 +08:00

28 lines
515 B
Markdown
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# [77. Combinations](https://leetcode.com/problems/combinations/)
## 题目
Given two integers *n* and *k*, return all possible combinations of *k* numbers out of 1 ... *n*.
**Example:**
Input: n = 4, k = 2
Output:
[
[2,4],
[3,4],
[2,3],
[1,2],
[1,3],
[1,4],
]
## 题目大意
给定两个整数 n 和 k返回 1 ... n 中所有可能的 k 个数的组合。
## 解题思路
- 计算排列组合中的组合,用 DFS 深搜即可,注意剪枝