Choose K Elements With Maximum Sum
For each index i, look at the nums2 values at indices where nums1 is strictly smaller than nums1[i], and compute the largest sum of at most k of them. Return these sums as an array.
For each index i, look at the nums2 values at indices where nums1 is strictly smaller than nums1[i], and compute the largest sum of at most k of them. Return these sums as an array.