Problem 3007 · Medium

Maximum Number That Sum of the Prices Is Less Than or Equal to K

Total prices grow monotonically, so binary search the largest number, counting set bits per position with a closed formula.

Open the interactive visualisation