int[][] climbingStaircase(int n, int k) {

if (n == 0 && k == 0) {

return new int[1][0];

}

int[] path = new int[1000];

List<List> matrix = new LinkedList<>();

findsteps(n, k, 0, 0, matrix, path);

return transformList(matrix);

}

```
int[][] transformList(List<List<Integer>> matrix) {
int[][] res = new int[matrix.size()][];
int i = 0;
for (List<Integer> list : matrix) {
res[i] = new int[list.size()];
for (int k = 0; k < res[i].length; k++) {
res[i][k] = list.get(k).intValue();
}
i++;
}
return res;
}
void findsteps(int n, int k, int sum, int idx, List<List<Integer>> matrix, int[] path) {
if (sum == n) {
List<Integer> res = new LinkedList<Integer>();
for (int i = 0; i < idx; i++) {
res.add(path[i]);
}
matrix.add(res);
return;
}
if (sum > n)
return;
if (sum < n) {
for (int i = 1; i <= k; i++) {
path[idx] = i;
findsteps(n, k, sum + i, idx + 1, matrix, path);
}
}
}
```