Skip to content

Commit f312ba1

Browse files
committed
fix topological sort
1 parent 5d4b96e commit f312ba1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

2301-2400/2392_build_a_matrix_with_conditions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def topological_sort(n, adj)
4040
order = []
4141
queue = (1..n).select { |i| indegrees[i].zero? }
4242
until queue.empty?
43-
u = queue.pop
43+
u = queue.shift
4444
order.push(u)
4545
adj[u].each { |v|
4646
indegrees[v] -= 1

0 commit comments

Comments
 (0)