A village panchayat counts the votes of an election. The list nums holds the ballots, and each number is the id of the party that got that vote.
One party won more than half of all the votes. If there are n votes, that party has more than n / 2 of them. A winner like this always exists in the data you get.
Return the id of the winning party.
Examples
Example 1:
Input: nums = [4,4,7]
Output: 4
Explanation: Party 4 has 2 of the 3 votes, which is more than half.
Example 2:
Input: nums = [9,1,9,1,9]
Output: 9
Explanation: Party 9 has 3 of the 5 votes, which is more than half.
Example 3:
Input: nums = [6]
Output: 6
Explanation: There is a single vote, and it goes to party 6.