Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Leetcode 1825. Finding MK Average
Maintain a sliding window of the last m stream elements and, after discarding the smallest k and largest k values, return the integer average of the remaining elements (return -1 if fewer than m elements). The core challenge is to support addElement and calculateMKAverage efficiently by keeping ordered partitions and their sums (e.g., via balanced BSTs/multisets or heaps with counts).
Asked at:
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Mid January, 2025
Mid-level
Calculate average server latency for last K values, ignoring top X values in a window of size K+X
Late December, 2024
Mid-level
Finding MK Average
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.