Medium · Math
Maximum Swap
Given a non-negative integer num, return the largest number you can get by swapping two of its digits at most once.
Examples
Example 1
{
"num": 2736
}Output: 7236
Example 2
{
"num": 9973
}Output: 9973
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.