Queue<Integer> queue = new LinkedList<>();
while (!queue.isEmpty()) {
int now = queue.poll();
System.out.print(now + " ");
for (int next : A.get(now)) {
indegree[next]--;
if (indegree[next] == 0) {
queue.offer(next);
}
}
}
'Hard deck > Basic' 카테고리의 다른 글
static (0) | 2022.08.15 |
---|---|
space and access (0) | 2022.08.15 |
Math.abs (0) | 2022.08.06 |
Handling Exception (0) | 2022.08.04 |
몫과 나머지 (0) | 2022.08.03 |