Question: Given an integer n, write a function to return all possible combinations of k numbers out of the range [1, n]. You may return the
Given an integer n, write a function to return all possible combinations of k numbers out of the range [1, n]. You may return the combinations in any order.
For example, if n = 4 and k = 2, the function should return [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]].
Step by Step Solution
3.43 Rating (156 Votes )
There are 3 Steps involved in it
The detailed answer for the above question is provided below def combinen k def backtrackstart curr ... View full answer
Get step-by-step solutions from verified subject matter experts
