Hackerland Radio Transmitters

  • + 0 comments

    Python:

    def hackerlandRadioTransmitters(x, k):
        x.sort()
        res = 1
        mid = x[0] + k
        for n in x:
            if n <= mid:
                end = n + k
            elif n > end:
                res += 1
                mid = n + k
        return res