mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 03:33:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			38 lines
		
	
	
		
			964 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			964 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>给你一个整数 <code>n</code> ,以二进制字符串的形式返回该整数的 <strong>负二进制(<code>base -2</code>)</strong>表示。</p>
 | 
						||
 | 
						||
<p><strong>注意,</strong>除非字符串就是 <code>"0"</code>,否则返回的字符串中不能含有前导零。</p>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>示例 1:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>n = 2
 | 
						||
<strong>输出:</strong>"110"
 | 
						||
<strong>解释:</strong>(-2)<sup>2</sup> + (-2)<sup>1</sup> = 2
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例 2:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>n = 3
 | 
						||
<strong>输出:</strong>"111"
 | 
						||
<strong>解释:</strong>(-2)<sup>2</sup> + (-2)<sup>1</sup> + (-2)<sup>0</sup> = 3
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例 3:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>n = 4
 | 
						||
<strong>输出:</strong>"100"
 | 
						||
<strong>解释:</strong>(-2)<sup>2</sup> = 4
 | 
						||
</pre>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>提示:</strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li><code>0 <= n <= 10<sup>9</sup></code></li>
 | 
						||
</ul>
 |