Maximum swap

0
Remix

Given a non-negative integer, swap two of its digits at most once to make the largest number possible. Record the last position of each digit, then find the first digit that has a larger digit later on.

MetaCodingLast asked Jul 2025
No answer yet. Write the first one; the best answer gets endorsed.