77 Combinations
77. Combinations
1. Question
Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.
For example, Ifn= 4 and k= 2, a solution is:
2. Implementation
(1) Backtracking
3. Time & Space Complexity
Backtracking: 时间复杂度O(C(n,k)), 空间复杂度O(C(n, k))
Last updated