You're given a non-negative integer num. You can swap two digits at most once to get the maximum valued number. Return the result. Meta asks this to evaluate your greedy reasoning with digit manipulation.
For example, num = 2736 returns 7236. Swapping 2 and 7 gives the largest possible number.
The challenge is choosing which pair to swap. How do you find the swap that gives the biggest improvement? Think about what makes a digit "out of place."
Constraints: .