Return the value that appears more than len(nums) / 2 times. If no value does, return -1.
Example 1
Input:
majority_element([2, 2, 1, 1, 2, 2, 3])
Output:
2
2 appears 4 times out of 7.
Example 2
Input:
majority_element([1, 2, 3])
Output:
-1
No value appears more than 1.5 times.
0 <= len(nums) <= 3 * 10**50 <= nums[i] <= 10**9No results yet
Run your code to check it against the examples, or submit to run every test.