HARDasked at 1 company

Finding MK Average

A hard-tier problem at 38% community acceptance, tagged with Design, Queue, Heap (Priority Queue). Reported in interviews at Google and 0 others.

Founder's read

Finding MK Average is a rare design problem that asks you to compute a rolling average while filtering out extremes from a stream of integers. Google has asked it, and the 38% acceptance rate signals it's genuinely hard. Most candidates underestimate the constraint: you can't just store raw values and sort them every time. The trick is picking the right data structure so you can efficiently remove the min and max from a window while maintaining the average. If you hit this live and freeze on the architecture, StealthCoder surfaces a working design in seconds, invisible to the proctor.

Companies asking
1
Difficulty
HARD
Acceptance
38%

Companies that ask "Finding MK Average"

If this hits your live OA

Finding MK Average is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know.

Get StealthCoder
What this means

The core challenge is that a naive approach (sort the window every query) times out. You need a structure that handles insertion, deletion, and min/max lookup in near-constant time. A combination of a Heap and an Ordered Set, or three Heaps with lazy deletion, solves it. The pattern: maintain a window of the last m integers. When queried, find the sum of all values except the smallest k and largest k, then divide by m minus 2k. Most fail because they either rebuild the data structure on every operation (TLE) or pick a single heap and can't efficiently remove arbitrary elements. The ordered set approach is cleaner: use one to track all window values, then iterate to skip k elements from each end. Design problems at this difficulty rarely appear in every loop, but when they do, knowing whether to reach for a TreeSet or multiple heaps decides the outcome immediately. StealthCoder hedges the live OA when the implementation details blur under pressure.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Finding MK Average recycles across companies for a reason. It's hard-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Finding MK Average interview FAQ

Is Finding MK Average still asked at Google?+

Yes. Google is the only company in public reports that asks it. With a 38% pass rate, it's a known hard problem reserved for strong candidates or late-stage rounds. If it appears, it's not a coincidence.

What's the trick to passing this problem?+

Stop trying to sort the window on every query. Use an ordered set (TreeSet in Java, sorted container in Python) or a combination of heaps to track min/max efficiently. The design decision happens first, implementation second. That's where most fail.

How does this problem relate to Design and Data Stream topics?+

It's a design problem because you're building a stateful object that processes a stream incrementally. Each call to addNumber() and getAverageOfCurrentStream() must be efficient. It's data stream because the input arrives one value at a time, and you can't reprocess the past.

Can I use a simple heap-based solution?+

A single min or max heap won't work because you need to remove arbitrary elements, not just the top. Two heaps work with lazy deletion (mark-as-deleted instead of removing), but an ordered set is cleaner and more intuitive to code correctly under time pressure.

What's the acceptance rate really telling me?+

38% is genuinely difficult. It means one in three candidates who reach this problem pass. Most stumble on data structure choice or off-by-one errors in the window logic. Implementation matters as much as the core idea.

Want the actual problem statement? View "Finding MK Average" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.