mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 03:33:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			31 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>给你一个整数 <code>num</code> 。<strong>重排</strong> <code>num</code> 中的各位数字,使其值 <strong>最小化</strong> 且不含 <strong>任何</strong> 前导零。</p>
 | 
						||
 | 
						||
<p>返回不含前导零且值最小的重排数字。</p>
 | 
						||
 | 
						||
<p>注意,重排各位数字后,<code>num</code> 的符号不会改变。</p>
 | 
						||
 | 
						||
<p> </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> </p>
 | 
						||
 | 
						||
<p><strong>提示:</strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li><code>-10<sup>15</sup> <= num <= 10<sup>15</sup></code></li>
 | 
						||
</ul>
 |