We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
x.sort()count=0whilex:leftHouse=x[0]#thisprovidesthelatestlefthousethatdoesnothaveconnection#print('leftHouse',leftHouse)whilexandleftHouse+k>=x[0]:#thispartensuresthatthevalueaddedcoversalllefthousesusingloop,whenthevaluegoesoutoftransmittersreachloopbreaks# print('leftHouse+k',leftHouse+k,'>=x[0]',x[0],'x=',x)transmitter=x.pop(0)#thisiterationplacestransmitter# print('new value of x after pop',x)## print('transmitter',transmitter)whilexandtransmitter+k>=x[0]:#thissidehandlesrightsideofthetransmissionprint('transmitterlooppop',x.pop(0))#thisismoreorlessdoinganincrement#print('new value of s after pop',x)count+=1returncount
Cookie support is required to access HackerRank
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 →