找出数组中超过数组长度一半的数
class soulution{
public int moreHalfnumber(Vector<Integer> numbers){
int n=numbers.size();
int count=1;
if(n==0) {
return 0;
}
int num=numbers.elementAt(0);
for (int i = 0; i <n; i++) {
if(numbers.elementAt(i)==num){
count++;
}
else{
count--;
}
if(count==0){
num=numbers.elementAt(i);
}
}
return num;
}
}