Algorithms · Hacker rank

HackerRank ‘ Hackerland Radio Transmitters ‘ Solution

Hackerland is a one-dimensional city with houses, where each house i is located at some xi on the x-axis. The Mayor wants to install radio transmitters on the roofs of the city's houses. Each transmitter has a range,k , meaning it can transmit a signal to all houses <=k units of distance away.