Interview Question

Software Engineer Interview



Find the deepest node of a binary tree. If multiple nodes are at the deepest level, then return the rightmost node.

AnswerAdd Tags

Interview Answer

1 Answer


it actually just sounds like a BFS, then return the last node you popped - assuming you enqueued left then right.

Anonymous on

Add Answers or Comments

To comment on this, Sign In or Sign Up.