Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 437 Bytes

README.md

File metadata and controls

25 lines (17 loc) · 437 Bytes

122.Maximum Swap

Description

Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get.

Example1

Input: 2736
Output: 7236
Explanation: Swap the number 2 and the number 7.

Example2

Input: 9973
Output: 9973
Explanation: No swap.

From

LeetCode