91. invert a binary tree
easy - accepted / - tried
Can you invert a binary tree and get an offer from Google?
Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off.— Max Howell (@mxcl) June 10, 2015
Inverting a node means swapping its left child and right child. You need to apply this to all nodes. As following figure illustrates.