<awangdev>Majority Number II_1.java
public int majorityNumber(List<Integer> nums) {
        if (nums == null || nums.size() == 0) {
            return -1;
        }
        int valA = 0; 
        int valB = 0;
        int countA = 0;
        int countB = 0;
        for (int num : nums) {
            if (num == valA) {
                countA++;
            } else if (num == valB) {
                countB++;
            } else if (countA == 0) {
                valA = num;
                countA++;
            } else if (countB == 0){
                valB = num;
                countB++;
            } else {
                countA--;
                countB--;
            }
        }
        
        countA = 0; 
        countB = 0;
        for (int num : nums) {
            if (num == valA) {
                countA++;
            } else if (num == valB) {
                countB++;
            }
        }
        return countA > countB ? valA : valB;
    }
public int sample_funcname ( List < Integer > var_2 ) {
  if ( var_2 == null || var_2 . size ( ) == 0 ) {
    return - 1 ;
  }
  int var_7 = 0 ;
  int var_8 = 0 ;
  int var_9 = 0 ;
  int var_10 = 0 ;
  for ( int var_11 : var_2 ) {
    if ( var_11 == var_7 ) {
      var_9 ++ ;
    }
    else if ( var_11 == var_8 ) {
      var_10 ++ ;
    }
    else if ( var_9 == 0 ) {
      var_7 = var_11 ;
      var_9 ++ ;
    }
    else if ( var_10 == 0 ) {
      var_8 = var_11 ;
      var_10 ++ ;
    }
    else {
      var_9 -- ;
      var_10 -- ;
    }
  }
  var_9 = 0 ;
  var_10 = 0 ;
  for ( int var_11 : var_2 ) {
    if ( var_11 == var_7 ) {
      var_9 ++ ;
    }
    else if ( var_11 == var_8 ) {
      var_10 ++ ;
    }
  }
  return var_9 > var_10 ? var_7 : var_8 ;
}
