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...
Top Freshworks Graduate Trainee interview questions & answers
Popular interview questions of Graduate Trainee
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