We would like to show you a description here but the site won’t allow us. How to Prepare Yourself for an Interview with Google. These tips and trick to help prepare for an interview with Google were sent to one of our students who had an interview with them. The format of the interview is discussed and what to expect while interviewing is also covered. At the end is a list of outside resources that would be.

'You developed an app which has over a million downloads, that's cute! But can you invert a binary tree '?

Question: Invert a Binary Tree.

What's meant by 'Invert Binary Tree ?'

It means for each node, the left-subtree of the node becomes the right-subtree and right-subtree becomes left-subtree.

Let's simplify the question step by step:

Step 1 > How to traverse the tree?
Aim : Our main aim is to:
1> visite each node.
2> swap left subtree and right subtree.
3> go deep in the respective subtree and repeat.

So it makes sense to use DFS in this case.

Step 2> How do we swap?
1> we could simply swap the sub-trees using a temporary container.