You are viewing a single comment's thread. Return to all comments →
def hackerlandRadioTransmitters(x, k): x.sort() antenas = [] i = 0 while i<len(x): house = x[i] antena = house y = i + 1 # print('---------------------') # print(f'house={house}, y={y}, antenas = {antenas}, antena:{antena}') if y >= len(x): antenas.append(antena) break while x[y] <= (house + k) and y<len(x): antena = x[y] y += 1 if y >= len(x): break antenas.append(antena) i = y if i >= len(x): break while x[i] <= antena + k and i<len(x): i += 1 if i >= len(x): break # return (antenas) return len(antenas)
Seems like cookies are disabled on this browser, please enable them to open this website
Hackerland Radio Transmitters
You are viewing a single comment's thread. Return to all comments →