values. Return the smallest number of elements to delete (the rest keep their order) so that a hill remains. This is guaranteed to be possible.values=[4, 1, 5, 7, 3, 3, 2] → 2
Remove the 1 and one of the 3s: [4, 5, 7, 3, 2] remains, climbing to 7 and then descending.
values=[1, 2, 1] → 0
The array is already a hill.
values can leave a hillvalues=[4, 1, 5, 7, 3, 3, 2]
2
Run checks the first 3 tests in your browser. Submit checks all 98 tests on the server, hidden ones included.