标签:
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋
times.
You may assume that the array is non-empty and the majority element always exist in the array.
思路:
最简单的,排序。虽然没超时,但肯定不好。
这里有一种更好的方法,想法很好。
标签:
原文地址:http://www.cnblogs.com/jiasaidongqi/p/4186258.html