Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2958. Length of Longest Subarray With at Most K Frequency
Find the maximum-length contiguous subarray of nums such that every distinct element appears at most k times. This is a sliding-window / frequency-counting problem on an array of length up to 1e5, solvable in O(n) time using a running count of element frequencies.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.