mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 03:33:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			36 lines
		
	
	
		
			870 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			870 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>给你一个整数数组 <code>nums</code> 。数组中唯一元素是那些只出现 <strong>恰好一次</strong> 的元素。</p>
 | 
						||
 | 
						||
<p>请你返回 <code>nums</code> 中唯一元素的 <strong>和</strong> 。</p>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>示例 1:</strong></p>
 | 
						||
 | 
						||
<pre><b>输入:</b>nums = [1,2,3,2]
 | 
						||
<b>输出:</b>4
 | 
						||
<b>解释:</b>唯一元素为 [1,3] ,和为 4 。
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例 2:</strong></p>
 | 
						||
 | 
						||
<pre><b>输入:</b>nums = [1,1,1,1,1]
 | 
						||
<b>输出:</b>0
 | 
						||
<b>解释:</b>没有唯一元素,和为 0 。
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例 3 :</strong></p>
 | 
						||
 | 
						||
<pre><b>输入:</b>nums = [1,2,3,4,5]
 | 
						||
<b>输出:</b>15
 | 
						||
<b>解释:</b>唯一元素为 [1,2,3,4,5] ,和为 15 。
 | 
						||
</pre>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>提示:</strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li><code>1 <= nums.length <= 100</code></li>
 | 
						||
	<li><code>1 <= nums[i] <= 100</code></li>
 | 
						||
</ul>
 |