1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/错误的集合 [set-mismatch].html
2022-03-29 12:43:11 +08:00

31 lines
956 B
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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>s</code> 包含从 <code>1</code> 到 <code>n</code> 的整数。不幸的是,因为数据错误,导致集合里面某一个数字复制了成了集合里面的另外一个数字的值,导致集合 <strong>丢失了一个数字</strong> 并且 <strong>有一个数字重复</strong></p>
<p>给定一个数组 <code>nums</code> 代表了集合 <code>S</code> 发生错误后的结果。</p>
<p>请你找出重复出现的整数,再找到丢失的整数,将它们以数组的形式返回。</p>
<p> </p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>nums = [1,2,2,4]
<strong>输出:</strong>[2,3]
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>nums = [1,1]
<strong>输出:</strong>[1,2]
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>2 <= nums.length <= 10<sup>4</sup></code></li>
<li><code>1 <= nums[i] <= 10<sup>4</sup></code></li>
</ul>