scores (equal scores sit next to each other). You are also given a number value.
Return True if **more than half** of the participants scored value, that is, it occurs in scores strictly more than len(scores) / 2 times. Otherwise return False.
The array is already sorted; think about how to use that instead of scanning all of it.scores=[3, 7, 7, 7, 7, 9], value=7 → True
7 appears 4 times out of 6, which is more than half.
scores=[2, 2, 5, 5], value=5 → False
5 appears exactly 2 times out of 4: that is exactly half, and strictly more is required.
scores=[1, 4, 4, 8, 8], value=6 → False
The value 6 is not in the list at all.
len(scores) ≤ 1000scores[i], value ≤ 10⁹scores is sorted in non-decreasing orderscores=[3, 7, 7, 7, 7, 9], value=7
True
Run checks the first 3 tests in your browser. Submit checks all 23 tests on the server, hidden ones included.