Available question text
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.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2488. Count Subarrays With Median K
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source