题目
Invert a binary tree.
Example:
1 | Input: |
Trivia:
This problem was inspired by this original tweet by Max Howell:
Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so f*** off.
思路
Recursive or Iterative.
代码
1 | # Definition for a binary tree node. |