1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/只出现一次的数字 [WGki4K].html
2022-03-29 12:43:11 +08:00

36 lines
1.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个整数数组&nbsp;<code>nums</code> ,除某个元素仅出现 <strong>一次</strong> 外,其余每个元素都恰出现 <strong>三次 。</strong>请你找出并返回那个只出现了一次的元素。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>nums = [2,2,3,2]
<strong>输出:</strong>3
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>nums = [0,1,0,1,0,1,100]
<strong>输出:</strong>100
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= nums.length &lt;= 3 * 10<sup>4</sup></code></li>
<li><code>-2<sup>31</sup> &lt;= nums[i] &lt;= 2<sup>31</sup> - 1</code></li>
<li><code>nums</code> 中,除某个元素仅出现 <strong>一次</strong> 外,其余每个元素都恰出现 <strong>三次</strong></li>
</ul>
<p>&nbsp;</p>
<p><strong>进阶:</strong>你的算法应该具有线性时间复杂度。 你可以不使用额外空间来实现吗?</p>
<p>&nbsp;</p>
<p><meta charset="UTF-8" />注意:本题与主站 137&nbsp;题相同:<a href="https://leetcode-cn.com/problems/single-number-ii/">https://leetcode-cn.com/problems/single-number-ii/</a></p>