 Digit multiplier
Medium Accuracy: 39.67% Submissions: 1644 Points: 4

Given a positive integer N, find the smallest number S such that the product of all the digits of S is equal to the number N. If there's no such number, Print "-1".

Example 1:

Input:
N = 100
Output:
455
Explanation:
4*5*5 = 100. There are no numbers
less than 455 with the product of
it's digit as 100.

Example 2:

Input:
N = 26
Output:
-1
Explanation:
There are no numbers which can form
a product of 26 with its digits.

You don't need to read input or print anything. Your task is to complete the function getSmallest() which takes an Integer N as input and returns the answer as a String.

Expected Time Complexity: O(log(N))
Expected Auxiliary Space: O(1)

Constraints:
1 <= N <= 109

We are replacing the old Disqus forum with the new Discussions section given below.

### Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

#### My Submissions:  