870. Advantage Shuffle Medium
1/**
2 * [870] Advantage Shuffle
3 *
4 * You are given two integer arrays nums1 and nums2 both of the same length. The advantage of nums1 with respect to nums2 is the number of indices i for which nums1[i] > nums2[i].
5 * Return any permutation of nums1 that maximizes its advantage with respect to nums2.
6 *
7 * Example 1:
8 * Input: nums1 = [2,7,11,15], nums2 = [1,10,4,11]
9 * Output: [2,11,7,15]
10 * Example 2:
11 * Input: nums1 = [12,24,8,32], nums2 = [13,25,32,11]
12 * Output: [24,32,8,12]
13 *
14 * Constraints:
15 *
16 * 1 <= nums1.length <= 10^5
17 * nums2.length == nums1.length
18 * 0 <= nums1[i], nums2[i] <= 10^9
19 *
20 */
21pub struct Solution {}
22
23// problem: https://leetcode.com/problems/advantage-shuffle/
24// discuss: https://leetcode.com/problems/advantage-shuffle/discuss/?currentPage=1&orderBy=most_votes&query=
25
26// submission codes start here
27
28impl Solution {
29 pub fn advantage_count(nums1: Vec<i32>, nums2: Vec<i32>) -> Vec<i32> {
30 vec![]
31 }
32}
33
34// submission codes end
35
36#[cfg(test)]
37mod tests {
38 use super::*;
39
40 #[test]
41 fn test_870() {
42 }
43}
44
Back
© 2025 bowen.ge All Rights Reserved.