← Back to challenges

Maximum Product of Digits

PythonHardnumbersmath

Instructions

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].

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.