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)/撞色搭配 [shu-zu-zhong-shu-zi-chu-xian-de-ci-shu-lcof].html
2023-12-09 18:53:53 +08:00

25 lines
804 B
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>sockets</code> 记录了一个袜子礼盒的颜色分布情况,其中 <code>sockets[i]</code> 表示该袜子的颜色编号。礼盒中除了一款撞色搭配的袜子,每种颜色的袜子均有两只。请设计一个程序,在时间复杂度 O(n)空间复杂度O(1) 内找到这双撞色搭配袜子的两个颜色编号。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>sockets = [4, 5, 2, 4, 6, 6]
<strong>输出:</strong>[2,5] 或 [5,2]
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>sockets = [1, 2, 4, 1, 4, 3, 12, 3]
<strong>输出:</strong>[2,12] 或 [12,2]</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>2 &lt;= sockets.length &lt;= 10000</code></li>
</ul>