Similar Problems

Similar Problems not available

Combinations - Leetcode Solution

Companies:

  • microsoft

LeetCode:  Combinations Leetcode Solution

Difficulty: Medium

Topics: backtracking  

Problem Source

Given two integers n and k, return all possible combinations of k numbers out of 1…n.

Example:

Input: n = 4, k = 2.

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

Combinations Solution Code

1