Problem 51 of 75

Maximum Subsequence Score

MediumNot solved yetInterview me on this
Before you code · which pattern fits?

The problem

You are given two arrays nums1 and nums2 of length n, and an integer k. Choose k indices; the score is (sum of chosen nums1 values) × (minimum of chosen nums2 values). Return the maximum possible score.

(nums1=[1,3,3,2], nums2=[2,1,3,4], k=3) → 12

Your solution runs against 2 unit tests, including edge and large-value cases.

Loading...

Test console · 2 unit tests

Submit your code to run it against all 2 unit tests. Results appear here.

JavaScript, TypeScript & Python run sandboxed in your browser; other languages run on the execution server. Your code is saved locally as you type.

Hint

Reference solution

Video explanation

Maximum Subsequence Score, explainedNeetCodeIO