Problem: Sequence Reconstruction. Task: Check if the topological sort is unique. Logic: In Kahn's algorithm, if at any point the queue size is greater than , it means you have choices. Choice implies multiple valid orderings. To ensure uniqueness, the queue size must always be throughout the entire process.
This means there is only one valid next node at every step. You check this condition inside your BFS loop.