<awangdev>169. Majority Element_5.java
public int majorityNumber(ArrayList<Integer> nums) {
        if (nums == null || nums.size() == 0) {
            return -1;
        }
        int majorNum = nums.get(0);
        int count = 1;
        for (int i = 1; i < nums.size(); i++) {
            if (majorNum == nums.get(i)) {
                count++;
            } else {
                count--;
            }
            if (count == 0) {
                majorNum = nums.get(i);
                count = 1;
            }
        }
        return majorNum;
    }
public int sample_funcname ( ArrayList < Integer > var_2 ) {
  if ( var_2 == null || var_2 . size ( ) == 0 ) {
    return - 1 ;
  }
  int var_8 = var_2 . get ( 0 ) ;
  int var_9 = 1 ;
  for ( int var_10 = 1 ;
  var_10 < var_2 . size ( ) ;
  var_10 ++ ) {
    if ( var_8 == var_2 . get ( var_10 ) ) {
      var_9 ++ ;
    }
    else {
      var_9 -- ;
    }
    if ( var_9 == 0 ) {
      var_8 = var_2 . get ( var_10 ) ;
      var_9 = 1 ;
    }
  }
  return var_8 ;
}
