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.
defhackerlandRadioTransmitters(x,k):size=len(x)ifsize==1:return1x.sort()num=0i=0whilei<size:# mark the furthest location within the coverage at current iloc=x[i]+k# move to the furthest house within the range and set transmitterwhilei<sizeandx[i]<=loc:i+=1i-=1num+=1# make the furthest location within the coverage at current iloc=x[i]+k# move to the first house outside the coveragewhilei<sizeandx[i]<=loc:i+=1returnnum
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 →