Tap here to switch tabs
Problem
Submissions

Problem: Maximum Subsequence Score

Maximum Subsequence Score asks you to choose k shared indices in two arrays and maximize the sum of selected nums1 values multiplied by the smallest selected nums2 value.

Statement

You are given two 00 indexed integer arrays nums1 and nums2 of length n, and a positive integer k.

Choose a subsequence of indices of length k. The score of selecting these indices is defined as the sum of the chosen elements in nums1 multiplied by the minimum of the chosen elements in nums2.

Return the maximum possible score.

Constraints:

  • n ==== nums1.length ==== nums2.length

  • 1≤1 \leq n ≤105\leq 10^5

  • 0≤0 \leq nums1[i], nums2[j] ≤105\leq 10^5

  • 1≤1 \leq k ≤\leq n

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Subsequence Score

Maximum Subsequence Score asks you to choose k shared indices in two arrays and maximize the sum of selected nums1 values multiplied by the smallest selected nums2 value.

Statement

You are given two 00 indexed integer arrays nums1 and nums2 of length n, and a positive integer k.

Choose a subsequence of indices of length k. The score of selecting these indices is defined as the sum of the chosen elements in nums1 multiplied by the minimum of the chosen elements in nums2.

Return the maximum possible score.

Constraints:

  • n ==== nums1.length ==== nums2.length

  • 1≤1 \leq n ≤105\leq 10^5

  • 0≤0 \leq nums1[i], nums2[j] ≤105\leq 10^5

  • 1≤1 \leq k ≤\leq n