NeetCode #248LC-2461MediumSliding Window
← Back to All Problems#248 · #2461 · Maximum Sum of Distinct Subarrays With Length K(长度为 K 子数组中的最大和)
📌 Problem Statement & Constraints
You are given an integer array
nums and an integer k. Find the maximum subarray sum for a subarray of length k where all elements are distinct. Return 0 if no such subarray exists. Constraints: 1 <= k <= nums.length <= 10^5, 1 <= nums[i] <= 10^5.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!