Given two integers n and k, return all possible combinations of k numbers chosen from the range [1, n].
You may return the answer in any order.
A combination is a selection of k elements where order does NOT matter. Unlike permutations, [1,2] and [2,1] are the same combination.
The number of ways to choose k items from n items is "n choose k" = n! / (k! * (n-k)!).
To avoid duplicates, we only consider elements in increasing order. When we choose element i, we only look at elements > i for subsequent positions.
n = 4, k = 2[[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]n = 1, k = 1[[1]]1 <= n <= 201 <= k <= nClick "Run" to execute your code against test cases
Socratic guidance - I'll ask questions, not give answers