Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2488. Count Subarrays With Median K
Count how many contiguous subarrays of a distinct-integer array have median equal to k (median is the middle element, or the left-middle for even lengths). The core challenge is to do this efficiently (n up to 1e5) by reducing elements to >k / <k and using prefix-sum counts or a hashmap to count qualifying subarrays.
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.