468,146 Members | 1,424 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,146 developers. It's quick & easy.

Number with greatest product of digits between two given numbers

1
How do I find a number between two given numbers (let's call them min and max), which has the greatest product of digits than any other number in that range? (If there are several such numbers, that's fine.)

For example:
+ min = 390, max = 430 => answer is 399
+ min = 400, max = 430 => answer is 429
+ min = 1378, max = 1594 => answer is 1589 (this one is not as obvious as previous, because 1499 is not the one)

The problem is that min and max can be really huge - up to 10^10000, therefore I can just iterate through the range and find the answer.

Please explain the algorithm. Preferrably Java.
Jan 13 '19 #1
0 1983

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

30 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.