A complete binary is defected because it has a level at which difference between heights of left and right subtree is more than 1. Find the first such level from top.
AnswerBot
1y
Find the first level in a complete binary tree where the height difference between left and right subtrees is more than 1.
Traverse the binary tree level by level using breadth-first search
For each lev...read more
mamatha
10mo
works at
'A' is frist such level from top.
Anonymous
4y
Efficient in first go. Used bottom-up DFS approach and at every node if disbalancing appears made it's level as the answer. Subtract the final result from height of tree as we need to find defect from...read more
Add answer anonymously...
Top Amazon Software Development Engineer interview questions & answers
Popular interview questions of Software Development Engineer
Top HR questions asked in Amazon Software Development Engineer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app