values and two integers reach and moves.
You must make exactly moves moves. In each move you pick an element that has **never been picked before** and add any integer from -reach to reach to it (0 included).
Return the largest number of equal elements the array can contain after all the moves.values=[2, 9, 6, 7], reach=2, moves=2 → 3
Shift 9 by -2 and 6 by +1 to get [2, 7, 7, 7]: three equal numbers.
values=[3, 3, 10, 14], reach=4, moves=1 → 2
The two 3s are already equal, and no other number is within 4 of them. 10 and 14 can also be made equal with one move. Either way the answer is 2.
values=[5], reach=0, moves=0 → 1
values=[2, 9, 6, 7], reach=2, moves=2
3
Run checks the first 3 tests in your browser. Submit checks all 70 tests on the server, hidden ones included.