Trains the technique from
LeetCode 216Combination Sum IIIThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A locksmith cuts notches into a key blank. A notch is cut to one of the nine standard depths 1 through 9, and a blank may not carry two notches of the same depth. A cutting plan is a set of count notch depths whose depths add up to total.
Return every cutting plan. Each plan must list its depths in increasing order, and the plans themselves must be ordered so that, comparing two plans depth by depth from the shallowest, the one with the smaller depth at the first place they differ comes first. Return an empty list when no plan exists.
Example 1
Each listed plan cuts two notches of different depths that add up to 7, and the plans are ordered by their shallowest notch.
Example 2
Every plan shown holds four different depths adding up to 30, for example 6 plus 7 plus 8 plus 9.
Example 3
Three different depths reach at most 9 plus 8 plus 7, which is 24, so no plan reaches 60 and the answer is the empty list.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def notch_sets(count: int, total: int) -> list[list[int]]:public List<List<Integer>> notchSets(int count, int total)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.