Hackerland Radio Transmitters

  • + 0 comments
        
        x.sort()
        count=0
        while x:
            
            leftHouse=x[0]#this provides the latest left house that does not have connection
            #print('leftHouse',leftHouse)
            while x and leftHouse+k >=x[0]:#this part ensures that the value added covers all left houses using loop ,when the value goes out of transmitters reach loop breaks
               # print('leftHouse+k',leftHouse+k,'>=x[0]',x[0],'x=',x)
                transmitter =x.pop(0)#this iteration places transmitter
               # print('new value of x after pop',x)
               ## print('transmitter',transmitter)
            while x and transmitter+k>=x[0]:#this side handles right side of the transmission
                print('transmitter  loop pop',x.pop(0))#this is more or less doing an increment
                #print('new value of s after pop',x)
            count+=1
        return count