Spread the Routers — Solution & Editorial
Binary search the answer d: greedily place a router at the first position and then at each next position ≥ d away; feasible iff C fit. Maximize the feasible d.
Complexity: O(N log N + N log max)
Binary search the answer d: greedily place a router at the first position and then at each next position ≥ d away; feasible iff C fit. Maximize the feasible d.
Complexity: O(N log N + N log max)