2841. Maximum Sum of Almost Unique Subarray
You are given an integer array
numsand two positive integersmandk.Return the maximum sum out of all almost unique subarrays of length
kofnums. If no such subarray exists, return0.A subarray of
numsis almost unique if it contains at leastmpairwise distinct elements.A subarray is a contiguous non-empty sequence of elements within an array.
1 | class Solution { |