Problem Statement | |||||||||||||
You will be given some decimal digits in a int[] digits. Build an integer with the minimum possible number of factors, using each of the digits exactly once (be sure to count all factors, not only the prime factors). If more than one number has the same (minimum) number of factors, return the smallest one among them. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | A factor of an integer n is an integer k, such that n % k = 0 (% being the modulo operator). | ||||||||||||
- | The digit 0 can also be used as a leading zero, see example 1. | ||||||||||||
Constraints | |||||||||||||
- | digits will have between 1 and 5 elements, inclusive. | ||||||||||||
- | Each element of digits will be between 0 and 9, inclusive. | ||||||||||||
- | At least one element of digits will be non-zero. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
| |||||||||||||
5) | |||||||||||||
|