91. 反转二叉树
分享给更多人
容易 -通过 / -执行
你能反转二叉树拿到Google的offer吗?
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
反转一个节点意味着其两个子节点发生了颠倒。你需要对二叉树中的所有节点做相同操作。就像下面这样。