<awangdev>621. Task Scheduler_2.java
public int leastInterval(char[] tasks, int n) {
        if (tasks == null) return 0;

        int[] count = new int[26];
        for (char c : tasks) count[c - 'A']++;
        Arrays.sort(count); 

        int max = count[25], i = 25;
        while (i >= 0 && count[i] == max) i--;
        int countRepeatedTopTask = 25 - i;

        return Math.max(tasks.length, (max - 1) * (n + 1) + countRepeatedTopTask);
    }
public int sample_funcname ( char [ ] var_0 , int var_1 ) {
  if ( var_0 == null ) return 0 ;
  int [ ] var_5 = new int [ 26 ] ;
  for ( char var_6 : var_0 ) var_5 [ var_6 - 'A' ] ++ ;
  Arrays . sort ( var_5 ) ;
  int max = var_5 [ 25 ] , var_12 = 25 ;
  while ( var_12 >= 0 && var_5 [ var_12 ] == max ) var_12 -- ;
  int var_13 = 25 - var_12 ;
  return Math . max ( var_0 . length , ( max - 1 ) * ( var_1 + 1 ) + var_13 ) ;
}
