public class Solution { public int MoreThanHalfNum_Solution(int [] array) { int result = 0; int record = array[0]; int size = array.length - 1; for(int i = 1;i < size ;i ++){ // if(result == 0){ // record = array[i]; // }

        if(record == array[i]){
            result ++;
        }
        else if(result > 0){
             result --;
        } 
        if(result == 0){
            record = array[i + 1];
        }
           
           
    }
    return record;
}

}