mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
23 lines
879 B
HTML
23 lines
879 B
HTML
<p>Given two arrays of integers, find a pair of values (one value from each array) that you can swap to give the two arrays the same sum.</p>
|
|
|
|
|
|
|
|
<p>Return an array, where the first element is the element in the first array that will be swapped, and the second element is another one in the second array. If there are more than one answers, return any one of them. If there is no answer, return an empty array.</p>
|
|
|
|
|
|
|
|
<p><strong>Example:</strong></p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
<strong>Input:</strong> array1 = [4, 1, 2, 1, 1, 2], array2 = [3, 6, 3, 3]
|
|
|
|
<strong>Output:</strong> [1, 3]
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<p><strong>Example:</strong></p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
<strong>Input:</strong> array1 = <code>[1, 2, 3], array2 = [4, 5, 6]</code>
|
|
|
|
<strong>Output: </strong>[]</pre>
|
|
|
|
|
|
|
|
<p><strong>Note: </strong></p>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li><code>1 <= array1.length, array2.length <= 100000</code></li>
|
|
|
|
</ul>
|
|
|