← Back to challenges

Rotate for Max Number

PythonHardlanguage_fundamentalslogicmathnumbers

Instructions

Create a function which takes a number and returns the maximum value by rearranging its digits.

Examples

rotate_max_number(123) ➞ 321

rotate_max_number("001") ➞ 100

rotate_max_number(999) ➞ 999

Notes

The input number can be a digit or a string.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Extract City Facts