Search
⌘K
Get Premium
Leetcode 2831. Find the Longest Equal Subarray
Given an array and at most k deletions, find the maximum length of a contiguous subarray that can be made constant (all equal) after removing ≤k elements — equivalently, for some value v find the longest window where at most k elements differ from v. This reduces to testing candidate values and using a sliding-window/counting strategy to maximize the equal-run length.
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.