You are viewing a single comment's thread. Return to all comments →
def hackerlandRadioTransmitters(x, k): t=0 #number of transmitters ind=0 #our location in Hackerland while ind<max(x): #Loops through the cities in list x if ind+1 not in x: ind+=1 #This makes sure we don’t place transmitters in places where there are no houses else: while ind+k+1 not in x: ind-=1 #This makes sure that the center is one of the houses t+=1 #Adds a transmitter ind+=(2*k+1) #skips all the locations where the transmitter is reached return t #returns the amount of of transmitters
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 →