数组中出现次数超过一半的数字:(摩尔投票法)
public int MoreThanHalfNum_Solution(int [] array) {
int size = array.length;
int count = 0;
int res = array[0];
for(int i = 0;i < size;i ++){
if(count == 0){
res = array[i];
count ++;
}else if(array[i] == res){
count ++;
}else{
count --;
}
}
return res;
}