1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-03-14 16:22:24 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/有序数组中的单一元素 [skFtm2].html

39 lines
1.1 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>给定一个只包含整数的有序数组 <code>nums</code>&nbsp;,每个元素都会出现两次,唯有一个数只会出现一次,请找出这个唯一的数字。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong> nums = [1,1,2,3,3,4,4,8,8]
<strong>输出:</strong> 2
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong> nums = [3,3,7,7,10,11,11]
<strong>输出:</strong> 10
</pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><meta charset="UTF-8" /></p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
<li><code>0 &lt;= nums[i]&nbsp;&lt;= 10<sup>5</sup></code></li>
</ul>
<p>&nbsp;</p>
<p><strong>进阶:</strong>采用的方案可以在 <code>O(log n)</code> 时间复杂度和 <code>O(1)</code> 空间复杂度中运行吗?</p>
<p>&nbsp;</p>
<p><meta charset="UTF-8" />注意:本题与主站 540&nbsp;题相同:<a href="https://leetcode-cn.com/problems/single-element-in-a-sorted-array/">https://leetcode-cn.com/problems/single-element-in-a-sorted-array/</a></p>