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)/交换和 [sum-swap-lcci].html
2022-03-29 12:43:11 +08:00

21 lines
804 B
HTML

<p>给定两个整数数组,请交换一对数值(每个数组中取一个数值),使得两个数组所有元素的和相等。</p>
<p>返回一个数组,第一个元素是第一个数组中要交换的元素,第二个元素是第二个数组中要交换的元素。若有多个答案,返回任意一个均可。若无满足条件的数值,返回空数组。</p>
<p><strong>示例:</strong></p>
<pre><strong>输入:</strong> array1 = [4, 1, 2, 1, 1, 2], array2 = [3, 6, 3, 3]
<strong>输出:</strong> [1, 3]
</pre>
<p><strong>示例:</strong></p>
<pre><strong>输入:</strong> array1 = <code>[1, 2, 3], array2 = [4, 5, 6]</code>
<strong>输出: </strong>[]</pre>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= array1.length, array2.length &lt;= 100000</code></li>
</ul>