Halloween SalePremium questions, over 30% offUnlock all premium questions for over 30% off
Tree Diagonal Traversal
Medium
Given a binary tree, print its diagonal traversal. In a diagonal traversal, all nodes that share the same number of right-edge traversals from the root are grouped together on the same diagonal.
More specifically, the diagonal index of a node equals the number of right edges on the path from root to that node. Within each diagonal, nodes are printed in the order they appear during a breadth-first traversal of the tree. ...
Asked at:Goldman Sachs
More Goldman Sachs interview questions
- Stack and Queue Implementationsmedium
- Parallel Task Schedulerhard
- Fire Spread in Binary Treemedium
- Best Average Scoreeasy
- Autocorrect Anagram Prototypeeasy
- Triangle Point Containmentmedium
- Optimal Team Formationmedium
- Compute Process Starvationmedium
OfferRetriever
Master technical interviews with real questions from top companies. Build your confidence and career.
LEGAL
© 2026 Purple Business Holdings LLC. All rights reserved. See Terms of Service.