leetcode 226. Invert Binary Tree 一分鐘解答 中文解說

Опубликовано: 12 Июль 2026
на канале: Billour Ou
167
0

226. Invert Binary Tree
Given the root of a binary tree, invert the tree, and return its root.

重點單字: invert 顛倒過來

這題如果你練習熟的話,
基本上可以一分鐘就解出來。

解題重點: 把遞迴(Recursion )背出來,且使用在這題上。


Recursion在寫程式時,記得要先把「終止條件」寫在最前面。 if(root = NULL)