Tap here to switch tabs
Problem
Submissions

Problem: Maximum Subsequence Score

med
30 min
Try to solve the Maximum Subsequence Score problem.

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

med
30 min
Try to solve the Maximum Subsequence Score problem.

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