Pick as many numbers as you can without their total going over k. Sorting works — can you beat it on average?
Pick as many numbers as you can without their total going over k. Sorting works — can you beat it on average?
Opens with the reference solution.