count **distinct** digits from 1 to 9 whose sum is total. Each digit may be used at most once, and zero is not allowed.
Return every such set of digits. Sets that differ only in the order of their digits are the same and must appear once. The sets, and the digits inside each set, may be listed in any order. If there are no valid sets, return an empty list.count=2, total=5 → [[1, 4], [2, 3]]
5 = 1 + 4 = 2 + 3. The split 0 + 5 does not count, since 0 is not allowed.
count=3, total=23 → [[6, 8, 9]]
The three largest digits give 7 + 8 + 9 = 24; only 6 + 8 + 9 makes 23.
count=3, total=5 → []
Even the three smallest digits give 1 + 2 + 3 = 6 > 5, so there are no sets.
count ≤ 9total ≤ 60count=2, total=5
[[1, 4], [2, 3]]
Run checks the first 3 tests in your browser. Submit checks all 60 tests on the server, hidden ones included.