226. Invert Binary Tree
DFS will do.
Invert a binary tree.
1 | 4 |
to
1 | 4 |
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.
Soulution:
1 | class Solution: |