Skip to content

Instantly share code, notes, and snippets.

@dscataglini
Created February 2, 2022 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dscataglini/aa338e5a5d515a7d5b267ad1d1594451 to your computer and use it in GitHub Desktop.
Save dscataglini/aa338e5a5d515a7d5b267ad1d1594451 to your computer and use it in GitHub Desktop.
Your task is to make a function that can take any non-negative integer as an argument and return it with its digits in descending order.
Essentially, rearrange the digits to create the highest possible number.
Examples:
Input: 42145 Output: 54421
Input: 145263 Output: 654321
Input: 123456789 Output: 987654321
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment