143: Combinations

Given integers n and k, return all possible combinations of k numbers out of [1 - n]

 

Example 1

Input:   n = 3, k = 1

Output:  [[1], [2], [3]]

Example 2

Input:   n = 3, k = 2

Output:  [[1, 2], [1, 3], [2, 3]]
Difficulty:Medium
Topic:Backtracking
Problem #:143