Skip to content

Practice Maximum Subsequence Score

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#2542
LeetCode Problem

Maximum Subsequence Score

Problem Statement

Choose exactly k different indices from equally sized nums1 and nums2. Their score is the sum of the chosen nums1 entries multiplied by the smallest chosen nums2 entry. Return the maximum possible score, using the same index set in both arrays.

Source: Maximum Subsequence Score on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums1 = [1,3,3,2], nums2 = [2,1,3,4], k = 3
Output
12

# Example 2

Input
nums1 = [4,2,3,1,1], nums2 = [7,5,10,9,6], k = 1
Output
30

Constraints

n == nums1.length == nums2.length
1 <= n <= 10^5
0 <= nums1[i], nums2[j] <= 10^5
1 <= k <= n

Related LeetCode Problems

Practice more problems similar to Maximum Subsequence Score.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.