mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 11:43:12 +08:00 
			
		
		
		
	国外版
This commit is contained in:
		
							
								
								
									
										36
									
								
								算法题(国外版)/smallest-good-base.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								算法题(国外版)/smallest-good-base.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
<p>Given an integer <code>n</code> represented as a string, return <em>the smallest <strong>good base</strong> of</em> <code>n</code>.</p>
 | 
			
		||||
 | 
			
		||||
<p>We call <code>k >= 2</code> a <strong>good base</strong> of <code>n</code>, if all digits of <code>n</code> base <code>k</code> are <code>1</code>'s.</p>
 | 
			
		||||
 | 
			
		||||
<p> </p>
 | 
			
		||||
<p><strong>Example 1:</strong></p>
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
<strong>Input:</strong> n = "13"
 | 
			
		||||
<strong>Output:</strong> "3"
 | 
			
		||||
<strong>Explanation:</strong> 13 base 3 is 111.
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p><strong>Example 2:</strong></p>
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
<strong>Input:</strong> n = "4681"
 | 
			
		||||
<strong>Output:</strong> "8"
 | 
			
		||||
<strong>Explanation:</strong> 4681 base 8 is 11111.
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p><strong>Example 3:</strong></p>
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
<strong>Input:</strong> n = "1000000000000000000"
 | 
			
		||||
<strong>Output:</strong> "999999999999999999"
 | 
			
		||||
<strong>Explanation:</strong> 1000000000000000000 base 999999999999999999 is 11.
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p> </p>
 | 
			
		||||
<p><strong>Constraints:</strong></p>
 | 
			
		||||
 | 
			
		||||
<ul>
 | 
			
		||||
	<li><code>n</code> is an integer in the range <code>[3, 10<sup>18</sup>]</code>.</li>
 | 
			
		||||
	<li><code>n</code> does not contain any leading zeros.</li>
 | 
			
		||||
</ul>
 | 
			
		||||
		Reference in New Issue
	
	Block a user