1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/重排数字的最小值 [smallest-value-of-the-rearranged-number].html
2022-03-29 12:43:11 +08:00

31 lines
1.0 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个整数 <code>num</code><strong>重排</strong> <code>num</code> 中的各位数字,使其值 <strong>最小化</strong> 且不含 <strong>任何</strong> 前导零。</p>
<p>返回不含前导零且值最小的重排数字。</p>
<p>注意,重排各位数字后,<code>num</code> 的符号不会改变。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>num = 310
<strong>输出:</strong>103
<strong>解释:</strong>310 中各位数字的可行排列有013、031、103、130、301、310 。
不含任何前导零且值最小的重排数字是 103 。
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>num = -7605
<strong>输出:</strong>-7650
<strong>解释:</strong>-7605 中各位数字的部分可行排列为:-7650、-6705、-5076、-0567。
不含任何前导零且值最小的重排数字是 -7650 。</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>-10<sup>15</sup> &lt;= num &lt;= 10<sup>15</sup></code></li>
</ul>