2847. Smallest Number With Given Digit Product
MathGreedy
Hints
Hint 1
Find the prime factors of
n.Hint 2
If there is a prime factor
p such that p >= 11, the answer is -1. Since there are no digits whose products equal p.Hint 3
Factors
5 and 7 should be included in the answer since their product with any number bigger than 1 is a 2-digit number.Hint 4
For factors
2 and 3, we group every three 2 into an 8 and every two 3 into a 9.Hint 5
For any leftover
2 or 3, check all the possible combinations.Preparing judge…