Invert a Binary Tree You are provided with a Binary Tree and one of its leaf nodes. You have to invert this binary tree. Inversion must be done by following all the below guidelines: • The given leaf node becomes the root after the inversion. • For a node (say, ‘x’) ○ If there exists the left child that is not yet take...

read more
CodingNinjas
author
2y

I explained the approach of swaping the child two nodes while traversing each node. The interview was fine with that approach

CodingNinjas
author
2y
In-order TraversalThe basic idea is to first fill all the nodes (in a stack) that are present in a path whose leaf node is the given leaf node using In-order traversal. And, then keep removing nodes f...
see more
Help your peers!
Add answer anonymously...
Freshworks Graduate Trainee 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
Get AmbitionBox app

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

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