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.
inthackerlandRadioTransmitters(vector<int>x,intk){sort(x.begin(),x.end());intn_radios=0;intN=x.size();inthouse=0;inti=0;while(i<N){house=x[i];// radio installed herewhile(i<N&&x[i]<=house+k){i++;}n_radios++;house=x[i-1];// radio installed herewhile(i<N&&x[i]<=house+k){i++;}}returnn_radios;
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 →
C++20