Continuous subarray sum and Cutting ribbons
Given a non-negative integer, you can switch the position of two digits at most once to create the largest possible number. Return the highest number you can form after performing this single swap.
If no swap can increase the number, return the original number.
Example 1: Input: 3821 Output: 8321 Explanation: Swap the digit 3 with 8 to get the maximum number. Example 2: Input: 7645 Output: 7645 Explanation: No swap can improve the number, so it remains the same. Example 3: Input: 1993 Output: 9913 Explanation: Swap the first 1 with 9 to get the maximum number.