Problem 2488 · Hard

Count Subarrays With Median K

A subarray has median k when the sorted middle element is k, so every window can be checked against its sorted middle.

Open the interactive visualisation