Tap here to switch tabs
Problem
Submissions

Problem: Smallest Number With Given Digit Product

Smallest Number With Given Digit Product asks you to return the smallest positive integer as a string whose digits multiply to a given positive number, or "-1" when no such number exists.

Statement

Given a positive integer n, return the smallest positive integer as a string such that the product of its digits is equal to n. If no such integer exists, return "-1".

Constraints:

  • 1≤1 \leq n ≤1018\leq 10^{18}

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Smallest Number With Given Digit Product

Smallest Number With Given Digit Product asks you to return the smallest positive integer as a string whose digits multiply to a given positive number, or "-1" when no such number exists.

Statement

Given a positive integer n, return the smallest positive integer as a string such that the product of its digits is equal to n. If no such integer exists, return "-1".

Constraints:

  • 1≤1 \leq n ≤1018\leq 10^{18}