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...
Amazon Software Development Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
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

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter