Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋
times.
int majorityElement(vector<int>& nums) {
int count=0,record;
for(int i=0;i<=nums.size();i++)
{
if(count==0)
{
record=nums[i];
count++;
}
else
record==nums[i]?count++:count--;
}
return record;
}