#3836
Maximum Score Using Exactly K Pairs
master · 1675 · lc hard +32 · 41.4% accepted · 65 likes · top 22%
Description
Given integer arrays nums1 (length n) and nums2 (length m), and an integer k, select exactly k index pairs (i1, j1), ..., (ik, jk) with strictly increasing i-indices (0 <= i1 < i2 < ... < ik < n) and strictly increasing j-indices (0 <= j1 < j2 < ... < jk < m). Each pair (i, j) contributes nums1[i] * nums2[j] to the score. Return the maximum achievable total score.
Code
1
2
3