[LeetCode] Maximum Swap 最大置换

Posted Grandyang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[LeetCode] Maximum Swap 最大置换相关的知识,希望对你有一定的参考价值。

 

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.

Example 1:

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

 

Example 2:

Input: 9973
Output: 9973
Explanation: No swap.

 

Note:

  1. The given number is in the range [0, 108]

 

s

 

以上是关于[LeetCode] Maximum Swap 最大置换的主要内容,如果未能解决你的问题,请参考以下文章