Domanda di colloquio di Apple

I was asked to invert a binary tree.