You are given two integer arrays nums1 and nums2 of size n, along with an integer k.
For each index i from n j such that nums1[j] < nums1[i]. From these indices, select at most k indices such that the sum of the corresponding values in nums2 is maximized.
Return an array ans of size n, where ans[i] represents the maximum sum of at most k elements in nums2 whose corresponding elements in nums1 are strictly less than nums1[i].
Constraints:
n nums1.length nums2.length
n
nums1[i], nums2[i]
k n
You are given two integer arrays nums1 and nums2 of size n, along with an integer k.
For each index i from n j such that nums1[j] < nums1[i]. From these indices, select at most k indices such that the sum of the corresponding values in nums2 is maximized.
Return an array ans of size n, where ans[i] represents the maximum sum of at most k elements in nums2 whose corresponding elements in nums1 are strictly less than nums1[i].
Constraints:
n nums1.length nums2.length
n
nums1[i], nums2[i]
k n