← All questions
Coding
Tree
Asked atAAugnito
Expedia
Meesho
MicrosoftTSTechMojo Solutions
1Give yourself 5 minutes
2Answer out loud, not in your head
3Then compare with the answer below
0
Stuck? Show a way to structure it+
- 01Ask for the required output and tree type.
- 02Choose DFS or BFS to match the requested order or property.
- 03State the per-node invariant or returned value.
- 04Cover null root and skewed depth.
Reference answer
Then expect these follow-ups
When is BFS preferable to DFS?
Tests: traversal choice
How do you validate that an input is a tree?
Tests: graphs
Hiring now
Expedia has 109 open roles right now
Also hiring: Meesho
landed applies to roles like these for you, on each company’s own site, with answers written for the role.
Get 5x interviews10 free auto-applies. No card.
Technical Program Manager III, AI & Data
India - Gurgaon
Solution Engineer
UK - London
Senior Business Programs Manager, Expedia Voices
USA - Illinois - Chicago
Next question