Given an integer array data of length n, return the element that appears strictly more than floor(n / 2) times. It is guaranteed that such an element exists in data.
Example 1
Input: [7,7,5,7]
Output: 7
Explanation: 7 appears 3 times, which is more than floor(4/2)=2.
Example 2
Input: [4,4,4,2,2]
Output: 4
Explanation: 4 appears 3 times, which is more than floor(5/2)=2.
Constraints
Case 1
Input: [10,10,10,3,3]
Expected: 10
Case 2
Input: [1,2,1,1]
Expected: 1
Case 3
Input: [6,6,6,6,2,2]
Expected: 6
Case 4
Input: [8,8,8,8,8,1,2,3]
Expected: 8