Coding · Medium · Pro
Combinations of k numbers from 1..n
CodingRecursionBacktrackingSenior
Approach
- Start next pick from
startto avoid duplicates. - Stop when path size == k.
Java Solution
Java
public List<List<Integer>> combine(int n, int k) {
List<List<Integer>> res = new Arra…