num
is 1, return 1 since the product of the digits of 1 is 1.factors
to store the factors of num
.num
is divisible by the current number.num
is divisible by the current number, append the current number to factors
and divide num
by the current number.num
is greater than 1 after the loop, return 0 since num
has a prime factor greater than 9, which cannot be a digit.factors
in ascending order and concatenate them into a string.