sorted_values in non-decreasing order. You may repeat this operation any number of times: pick two elements with **different** values and remove both from the array. The remaining elements keep their order.
Return the smallest length the array can be reduced to.sorted_values=[1, 1, 2, 3, 3, 3] → 0
Remove the pairs (1, 3), (1, 3) and (2, 3) and the array is empty.
sorted_values=[4, 4, 4, 4, 7] → 3
The 7 can go only together with one 4. The remaining three 4s are equal, so none of them can be removed.
sorted_values=[2, 5, 9] → 1
sorted_values=[1, 1, 2, 3, 3, 3]
0
Run checks the first 3 tests in your browser. Submit checks all 124 tests on the server, hidden ones included.