1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/优势洗牌 [advantage-shuffle].html

30 lines
1.1 KiB
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>给定两个大小相等的数组&nbsp;<code>nums1</code>&nbsp;&nbsp;<code>nums2</code><code>nums1</code>&nbsp;相对于 <code>nums</code>&nbsp;<em>优势</em>可以用满足&nbsp;<code>nums1[i] &gt; nums2[i]</code>&nbsp;的索引 <code>i</code>&nbsp;的数目来描述。</p>
<p>返回 <font color="#c7254e" face="Menlo, Monaco, Consolas, Courier New, monospace" size="1"><span style="background-color: rgb(249, 242, 244);">nums1</span></font>&nbsp;<strong>任意</strong>排列,使其相对于 <code>nums2</code>&nbsp;的优势最大化。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>nums1 = [2,7,11,15], nums2 = [1,10,4,11]
<strong>输出:</strong>[2,11,7,15]
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>nums1 = [12,24,8,32], nums2 = [13,25,32,11]
<strong>输出:</strong>[24,32,8,12]
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= nums1.length &lt;= 10<sup>5</sup></code></li>
<li><code>nums2.length == nums1.length</code></li>
<li><code>0 &lt;= nums1[i], nums2[i] &lt;= 10<sup>9</sup></code></li>
</ul>