Leetcode 2962. Count Subarrays Where Max Element Appears at Least K Times
Count the number of contiguous subarrays whose maximum element occurs at least k times; the challenge is to avoid brute force by efficiently using the positions/frequencies of candidate maximum values (n up to 1e5) to count valid subarrays.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Your account is free and you can post anonymously if you choose.