Problem 3348 · Hard

Smallest Divisible Digit Product II

Given a numeric string and an integer t, find the smallest number no less than it that has no zero digits and whose digit product is a multiple of t. Return "-1" when no such number exists.

Open the interactive visualisation