Tap here to switch tabs
Problem
Submissions

Problem: Smallest Divisible Digit Product II

Try to solve the Smallest Divisible Digit Product II problem.

Statement

You are given a string num representing a positive integer, and an integer t.

Return a string representing the smallest integer that is greater than or equal to num, contains no $0$ digits, and whose digit product is divisible by t. If no such integer exists, return "$-1$".

Constraints:

  • 2≤2 \leq num.length ≤2imes105\leq 2 imes 10^5

  • num consists only of digits in the range ['$0$', '$9$'].

  • num does not contain leading zeros.

  • 1≤1 \leq t ≤1014\leq 10^{14}

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Smallest Divisible Digit Product II

Try to solve the Smallest Divisible Digit Product II problem.

Statement

You are given a string num representing a positive integer, and an integer t.

Return a string representing the smallest integer that is greater than or equal to num, contains no $0$ digits, and whose digit product is divisible by t. If no such integer exists, return "$-1$".

Constraints:

  • 2≤2 \leq num.length ≤2imes105\leq 2 imes 10^5

  • num consists only of digits in the range ['$0$', '$9$'].

  • num does not contain leading zeros.

  • 1≤1 \leq t ≤1014\leq 10^{14}