Hi guys!

The idea is to iteratively generate combinations for all lengths from 1 to k. We start with a list of all numbers <= n as combinations for k == 1. When we have all combinations of length k-1, we can get the new ones for a length k with trying to add to each one all elements that are <= n and greater than the last element of a current combination.

I think the code here will be much more understandable than further attempts to explain. :) See below.

Hope it helps!

```
public class Solution {
public List<List<Integer>> combine(int n, int k) {
if (k == 0 || n == 0 || k > n) return Collections.emptyList();
List<List<Integer>> combs = new ArrayList<>();
for (int i = 1; i <= n; i++) combs.add(Arrays.asList(i));
for (int i = 2; i <= k; i++) {
List<List<Integer>> newCombs = new ArrayList<>();
for (int j = i; j <= n; j++) {
for (List<Integer> comb : combs) {
if (comb.get(comb.size()-1) < j) {
List<Integer> newComb = new ArrayList<>(comb);
newComb.add(j);
newCombs.add(newComb);
}
}
}
combs = newCombs;
}
return combs;
}
}
```