MEDIUMasked at 7 companies

Heaters

A medium-tier problem at 40% community acceptance, tagged with Array, Two Pointers, Binary Search. Reported in interviews at Anduril and 6 others.

Founder's read

Heaters hits you with a distance-minimization problem that looks straightforward until you realize the greedy path doesn't work. You've got houses on a line and heaters on a line. Each house needs to be within range of at least one heater. Find the minimum heater radius that covers all houses. Companies like Anduril, Intuit, Bloomberg, and TikTok have all asked it. The 40% acceptance rate reflects a common trap: candidates jump to greedy or brute force and time out or miss edge cases. The real solution uses sorting and either two pointers or binary search. If this pattern hits your live assessment and you blank, StealthCoder surfaces the correct approach in seconds, invisible to the proctor.

Companies asking
7
Difficulty
MEDIUM
Acceptance
40%

Companies that ask "Heaters"

If this hits your live OA

Heaters 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 an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.

Get StealthCoder
What this means

The trick is recognizing this as a min-max optimization problem, not a greedy one. After sorting both arrays, you iterate through each house and find the closest heater to it. The distance from that house to its nearest heater becomes part of your answer. The answer is the maximum of all these minimum distances. Two pointers is cleaner than binary search here because you can advance the heater pointer monotonically. The trap candidates fall into: trying to assign heaters greedily or calculating coverage radius per heater instead of per house. Another miss: forgetting that heaters can be outside the house range entirely. When you're live and stuck on the optimization logic, StealthCoder runs invisibly and gives you the exact two-pointer or binary search structure to code from.

Pattern tags

The honest play

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

Heaters recycles across companies for a reason. It's medium-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 an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Heaters interview FAQ

Why doesn't greedy work on this problem?+

Greedy assigns heaters to houses sequentially, but optimal coverage requires checking which single heater is closest to each house, then taking the worst-case distance. The problem asks for the minimum radius that covers all houses, not the minimum total coverage. That global min-max constraint breaks local greedy decisions.

Is Heaters still actively asked at top companies?+

Yes. It appears in reports from Anduril, Intuit, Bloomberg, TikTok, and others. It's not a brand-new problem, but it's reliable enough that 7 companies across different sectors have used it. It tests sorting and pointer logic, which are interview staples.

Two pointers or binary search. Which is better?+

Two pointers is faster to code and more intuitive here. You advance both pointers through sorted arrays in one pass. Binary search works too but adds complexity for no real gain. In an OA, two pointers is the hedge against implementation bugs and off-by-one errors.

What's the edge case that trips people up?+

A house with no heater in range. Also, a heater outside the house boundaries on either end. You need to handle the case where a house is farther from all heaters than expected. Reading the problem carefully on your first pass saves debug time.

How does Heaters relate to the other Array/Two Pointer topics?+

It combines all three: you sort the arrays (Array), use two pointers to find closest heater to each house (Two Pointers), and could use binary search to find the heater positions (Binary Search). It's a good test of when each technique applies and when to chain them.

Want the actual problem statement? View "Heaters" 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.