Force link :https://leetcode-cn.com/probl...
Their thinking :
- Solution 1 : Hashtable , Traversing arrays directly , Record the number of each number , Then find a number larger than normal
- Solution 2 : Because most of the elements in the array , Then you can sort this array , The element in the middle must be at most more than half of the elements
func majorityElement(nums []int) int {
sort.Ints(nums)
return nums[len(nums) / 2]
}


![[shutter] shutter gesture interaction (click event handling | click OnTap | double click | long press | click Cancel | press ontapdown | lift ontapup)](/img/fa/5c1b6c16d9aabd13e9a4f7c7b9c7da.jpg)



![[shutter] shutter layout component (fractionallysizedbox component | stack layout component | positioned component)](/img/5f/e96baefd9481c496024fed345e31fe.jpg)

