This is a verified interview question from Zomato. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Valid BFS Traversal - Zomato OA" covers key patterns like Graphs.
"### Problem You are given the edges that form a tree with the root as 0. A traversal of the tree is generated in the following manner: * An empty queue q is initialized and the node 0 is pushed into it. * While the queue is not empty, the front element is popped and all its children are pushed into the queue in any arbitary order. * The popped element is added to the traversal. You are given multiple traversals of the tree, and you need to find which of the traversals provided can be a valid BFS order traversal of the same."
Join thousands of developers practicing for Zomato.