<awangdev>1007. Minimum Domino Rotations For Equal Row_1.java
public int minDominoRotations(int[] A, int[] B) {
        int[] countA = new int[7], countB = new int[7], overlap = new int[7];
        int n = A.length;
        for (int i = 0; i < n; ++i) {
            countA[A[i]]++;
            countB[B[i]]++;
            if (A[i] == B[i]) overlap[A[i]]++;
        }
        for (int i = 1; i < 7; ++i) {
            if (countA[i] + countB[i] - overlap[i] == n) return n - Math.max(countA[i], countB[i]);
        }
        return -1;
    }
public int sample_funcname ( int [ ] var_0 , int [ ] var_1 ) {
  int [ ] var_3 = new int [ 7 ] , var_4 = new int [ 7 ] , var_5 = new int [ 7 ] ;
  int var_7 = var_0 . length ;
  for ( int var_9 = 0 ;
  var_9 < var_7 ;
  ++ var_9 ) {
    var_3 [ var_0 [ var_9 ] ] ++ ;
    var_4 [ var_1 [ var_9 ] ] ++ ;
    if ( var_0 [ var_9 ] == var_1 [ var_9 ] ) var_5 [ var_0 [ var_9 ] ] ++ ;
  }
  for ( int var_9 = 1 ;
  var_9 < 7 ;
  ++ var_9 ) {
    if ( var_3 [ var_9 ] + var_4 [ var_9 ] - var_5 [ var_9 ] == var_7 ) return var_7 - Math . max ( var_3 [ var_9 ] , var_4 [ var_9 ] ) ;
  }
  return - 1 ;
}
