Trains the technique from
LeetCode 3345Smallest Divisible Digit Product IThis 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 stockroom numbers its shelves with positive whole numbers. A shelf label is valid for a crate of type t when the product of the label's decimal digits is a multiple of t.
The next free shelf is n, and the crate may be placed on shelf n or on any higher-numbered shelf. Return the smallest label at or above n that is valid for t.
A label containing the digit 0 has a digit product of 0, and 0 counts as a multiple of every positive t.
Example 1
Shelf 15 has digit product 5 and shelf 16 has digit product 6, neither of which is a multiple of 7. Shelf 17 has digit product 7.
Example 2
Shelves 16 through 19 have digit products 6, 7, 8 and 9. Shelf 20 has digit product 0, which counts as a multiple of 10.
Example 3
Shelf 99 has digit product 81, and 81 is 9 times 9.
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 smallest_shelf_label(n: int, t: int) -> int:public int smallestShelfLabel(int n, int t)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.