Maximum Product of Digits

Published by Helen Yu in

Write a function that returns all numbers less than or equal to N with the maximum product of digits.

Examples

max_product(8) ➞ [8]

max_product(27) ➞ [27]

max_product(211) ➞ [99, 199]

max_product(9578) ➞ [8999]

Notes

Search for numbers in the range: [0, n].

Watch a quick demo on how Edabit works.