class Solution {
public:
int moreThanHalfNum_Solution(vector<int>& nums) {
stack<int> arr;
for(int i=0; i<nums.size(); i++)
{
if(!arr.size()) arr.push(nums[i]);
else if(arr.top()!=nums[i]) arr.pop();
else arr.push(nums[i]);
}
return arr.top();
}
};