91. Combinations

Return all combinations of k numbers chosen from the range [1, n].
Example 1
Input: n = 4, k = 2
Output: [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
Explanation: All pairs from four numbers.
Example 2
Input: n = 1, k = 1
Output: [[1]]
Explanation: The only combination.
arraysmediumrecursion
JavaScript
Loading...
Line 1, Char 1