()
| 4 | let currentValue = 1 |
| 5 | |
| 6 | function findCombinations() { |
| 7 | if (currentCombination.length === k) { |
| 8 | // Add the array of size k to the allCombinations array |
| 9 | allCombinations.push([...currentCombination]) |
| 10 | return |
| 11 | } |
| 12 | if (currentValue > n) { |
| 13 | // Check for exceeding the range |
| 14 | return |
| 15 | } |
| 16 | currentCombination.push(currentValue++) |
| 17 | findCombinations() |
| 18 | currentCombination.pop() |
| 19 | findCombinations() |
| 20 | currentValue-- |
| 21 | } |
| 22 | |
| 23 | findCombinations() |
| 24 |
no test coverage detected