You are given an array of distinct integers nums and an integer k.
Your task is to return all possible combinations of k numbers chosen from nums.
You may assume that:
nums are distinct.k <= nums.lengthReturn a list of all possible combinations. The order of combinations in the output does not matter, and the order of numbers within each combination does not matter.
nums = [1, 2, 3, 4]
k = 2
[ [1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4] ]
There are C(4, 2) = 6 combinations of 2 numbers chosen from [1, 2, 3, 4].
nums = [5, 10, 15]
k = 2
[ [5, 10], [5, 15], [10, 15] ]
There are C(3, 2) = 3 combinations of 2 numbers chosen from [5, 10, 15].
nums = [1, 2, 3, 4]
k = 2
[ [1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4] ]