mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
33 lines
808 B
HTML
33 lines
808 B
HTML
|
<p>给你一个仅由整数组成的有序数组,其中每个元素都会出现两次,唯有一个数只会出现一次。</p>
|
||
|
|
||
|
<p>请你找出并返回只出现一次的那个数。</p>
|
||
|
|
||
|
<p>你设计的解决方案必须满足 <code>O(log n)</code> 时间复杂度和 <code>O(1)</code> 空间复杂度。</p>
|
||
|
|
||
|
<p> </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> </p>
|
||
|
|
||
|
<p><meta charset="UTF-8" /></p>
|
||
|
|
||
|
<p><strong>提示:</strong></p>
|
||
|
|
||
|
<ul>
|
||
|
<li><code>1 <= nums.length <= 10<sup>5</sup></code></li>
|
||
|
<li><code>0 <= nums[i] <= 10<sup>5</sup></code></li>
|
||
|
</ul>
|