Leetcode 2542 : Maximum Subsequence Score (Medium)

preview_player
Показать описание
You are given two 0-indexed integer arrays nums1 and nums2 of equal length n and a positive integer k. You must choose a subsequence of indices from nums1 of length k.

For chosen indices i0, i1, ..., ik - 1, your score is defined as:

The sum of the selected elements from nums1 multiplied with the minimum of the selected elements from nums2.
It can defined simply as: (nums1[i0] + nums1[i1] +...+ nums1[ik - 1]) * min(nums2[i0] , nums2[i1], ... ,nums2[ik - 1]).

Return the maximum possible score.

#leetcode #coding #priorityqueue #leetcode_medium #leetcode #codemodecode #programming #codinginterview #placement #sorting
Рекомендации по теме
welcome to shbcf.ru