Class Solution
-
- All Implemented Interfaces:
public final class Solution870 - Advantage Shuffle.
Medium
You are given two integer arrays
nums1andnums2both of the same length. The advantage ofnums1with respect tonums2is the number of indicesifor whichnums1[i] > nums2[i].Return any permutation of
nums1that maximizes its advantage with respect tonums2.Example 1:
Input: nums1 = 2,7,11,15, nums2 = 1,10,4,11
Output: 2,11,7,15
Example 2:
Input: nums1 = 12,24,8,32, nums2 = 13,25,32,11
Output: 24,32,8,12
Constraints:
<code>1 <= nums1.length <= 10<sup>5</sup></code>
nums2.length == nums1.length<code>0 <= nums1i, nums2i<= 10<sup>9</sup></code>
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final IntArrayadvantageCount(IntArray nums1, IntArray nums2)-
-
Method Detail
-
advantageCount
final IntArray advantageCount(IntArray nums1, IntArray nums2)
-
-
-
-