Given an array nums of size n, return the majority element — the element that appears more than ⌊n/2⌋ times. The majority element always exists.
nums = [3,2,3]3Think of it as elections: each majority vote cancels one minority vote. Since the majority appears more than n/2 times, it can absorb all cancellations from minority elements and still survive with a positive count at the end.