comefrom: <awangdev>210. Course Schedule II_1.java
code: public int[] findOrder(int numCourses, int[][] prerequisites) {
          if (numCourses == 0 || prerequisites == null) {
              return new int[numCourses];
          }
  
          List[] inDegreeEdges = new ArrayList[numCourses];
          int[] dependencyCount = new int[numCourses];
          
          for (int i = 0; i < numCourses; i++) inDegreeEdges[i] = new ArrayList<>();
          
          for (int[] prerequisite : prerequisites) {
              inDegreeEdges[prerequisite[1]].add(prerequisite[0]);
              dependencyCount[prerequisite[0]]++;
          }
          
          Queue<Integer> queue = new LinkedList<>();
          for (int i = 0; i < numCourses; i++) {
              if (dependencyCount[i] == 0) queue.add(i);
          }
  
          List<Integer> sortedList = new ArrayList<>();
          while (!queue.isEmpty()) {
              int leafNode = queue.poll();
              sortedList.add(leafNode); 
              List<Integer> dependencies = inDegreeEdges[leafNode];
              for (int node : dependencies) {
                  if (--dependencyCount[node] == 0) queue.add(node);
              }
          }
          
          if (sortedList.size() != numCourses) {
              return new int[0];
          }
  
          int[] rst = new int[sortedList.size()];
          for (int i = 0; i < sortedList.size(); i++) {
              rst[i] = sortedList.get(i);
          }
          return rst;
      }
masked: public int [ ] sample_funcname ( int var_0 , int [ ] [ ] var_1 ) {
    if ( var_0 == 0 || var_1 == null ) {
      return new int [ var_0 ] ;
    }
    List [ ] var_2 = new ArrayList [ var_0 ] ;
    int [ ] var_3 = new int [ var_0 ] ;
    for ( int var_4 = 0 ;
    var_4 < var_0 ;
    var_4 ++ ) var_2 [ var_4 ] = new ArrayList < > ( ) ;
    for ( int [ ] var_5 : var_1 ) {
      var_2 [ var_5 [ 1 ] ] . add ( var_5 [ 0 ] ) ;
      var_3 [ var_5 [ 0 ] ] ++ ;
    }
    Queue < Integer > var_6 = new LinkedList < > ( ) ;
    for ( int var_4 = 0 ;
    var_4 < var_0 ;
    var_4 ++ ) {
      if ( var_3 [ var_4 ] == 0 ) var_6 . add ( var_4 ) ;
    }
    List < Integer > var_7 = new ArrayList < > ( ) ;
    while ( ! var_6 . isEmpty ( ) ) {
      int var_8 = var_6 . poll ( ) ;
      var_7 . add ( var_8 ) ;
      List < Integer > var_9 = var_2 [ var_8 ] ;
      for ( int var_10 : var_9 ) {
        if ( -- var_3 [ var_10 ] == 0 ) var_6 . add ( var_10 ) ;
      }
    }
    if ( var_7 . size ( ) != var_0 ) {
      return new int [ 0 ] ;
    }
    int [ ] var_11 = new int [ var_7 . size ( ) ] ;
    for ( int var_4 = 0 ;
    var_4 < var_7 . size ( ) ;
    var_4 ++ ) {
      var_11 [ var_4 ] = var_7 . get ( var_4 ) ;
    }
    return var_11 ;
  }
  