You are viewing a single comment's thread. Return to all comments →
static void solve(ArrayList<Integer> casas, int k) { int n = casas.size(); int i = 0; int numAntenas = 0; while (i < n) { numAntenas++; int loc = casas.get(i) + k; while (i < n && casas.get(i) <= loc) { i++; } loc = casas.get(i - 1) + k; while (i < n && casas.get(i) <= loc) { i++; } } System.out.println(numAntenas); }
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 →