mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-04 15:01:40 +08:00
国外版
This commit is contained in:
27
算法题(国外版)/maximum-swap.html
Normal file
27
算法题(国外版)/maximum-swap.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<p>You are given an integer <code>num</code>. You can swap two digits at most once to get the maximum valued number.</p>
|
||||
|
||||
<p>Return <em>the maximum valued number you can get</em>.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> num = 2736
|
||||
<strong>Output:</strong> 7236
|
||||
<strong>Explanation:</strong> Swap the number 2 and the number 7.
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> num = 9973
|
||||
<strong>Output:</strong> 9973
|
||||
<strong>Explanation:</strong> No swap.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>0 <= num <= 10<sup>8</sup></code></li>
|
||||
</ul>
|
Reference in New Issue
Block a user