← Back to problems LC 475 →

Heaters

LeetCode 475 • Medium • Two Pointers • Anduril

Houses [1,2,3,4], heaters [1,4] → min radius 1. Sort + two pointers / binary search on positions.

TimeO(n log n)
SpaceO(1)
House
Heater
Radius
step
note
Ready
Press Play to walk the algorithm.