Problem 2557 · Medium

Maximum Number of Integers to Choose From a Range II

Take the smallest allowed numbers first; walk the gaps between banned values and size each gap by binary search on the budget.

Open the interactive visualisation