NeetCode #249LC-2958MediumSliding Window
← Back to All Problems#249 · #2958 · Length of Longest Subarray With at Most K Frequency(最多 K 个重复元素的最长子数组)
📌 Problem Statement & Constraints
Given an array of integers
nums and an integer k, return the length of the longest subarray where the frequency of each element is at most k. Constraints: 1 <= nums.length <= 10^5, 1 <= nums[i] <= 10^9, 1 <= k <= nums.length.🔒
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!