values and an integer budget. In one step you may raise or lower any element by 1, and you may take at most budget steps in total.
Return the largest number of equal elements the array can contain once you are done.values=[10, 3, 7, 8], budget=4 → 3
Move 7 and 10 to 8 in 1 + 2 = 3 steps and you get three 8s. Making all four numbers equal takes at least 8 steps.
values=[2, 9, 2, 5], budget=0 → 2
No steps are allowed, and 2 already appears twice.
values=[1, 100], budget=99 → 2
values=[10, 3, 7, 8], budget=4
3
Run checks the first 3 tests in your browser. Submit checks all 99 tests on the server, hidden ones included.