mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 03:33:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			45 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>给你一个整数数组 <code>nums</code> ,返回数组中最大数和最小数的 <strong>最大公约数</strong> 。</p>
 | 
						||
 | 
						||
<p>两个数的 <strong>最大公约数</strong> 是能够被两个数整除的最大正整数。</p>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>示例 1:</strong></p>
 | 
						||
 | 
						||
<pre><strong>输入:</strong>nums = [2,5,6,9,10]
 | 
						||
<strong>输出:</strong>2
 | 
						||
<strong>解释:</strong>
 | 
						||
nums 中最小的数是 2
 | 
						||
nums 中最大的数是 10
 | 
						||
2 和 10 的最大公约数是 2
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例 2:</strong></p>
 | 
						||
 | 
						||
<pre><strong>输入:</strong>nums = [7,5,6,8,3]
 | 
						||
<strong>输出:</strong>1
 | 
						||
<strong>解释:</strong>
 | 
						||
nums 中最小的数是 3
 | 
						||
nums 中最大的数是 8
 | 
						||
3 和 8 的最大公约数是 1
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例 3:</strong></p>
 | 
						||
 | 
						||
<pre><strong>输入:</strong>nums = [3,3]
 | 
						||
<strong>输出:</strong>3
 | 
						||
<strong>解释:</strong>
 | 
						||
nums 中最小的数是 3
 | 
						||
nums 中最大的数是 3
 | 
						||
3 和 3 的最大公约数是 3
 | 
						||
</pre>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>提示:</strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li><code>2 <= nums.length <= 1000</code></li>
 | 
						||
	<li><code>1 <= nums[i] <= 1000</code></li>
 | 
						||
</ul>
 |