This commit is contained in:
2026-06-21 20:46:23 +10:00
parent c4cfce490e
commit f873a89c82
6 changed files with 227 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
package top100liked
import (
"testing"
)
// https://leetcode.cn/problems/invert-binary-tree/description/?envType=study-plan-v2&envId=top-100-liked
type TreeNode struct {
Val int
Left *TreeNode
Right *TreeNode
}
func invertTree(root *TreeNode) *TreeNode {
if root == nil {
return nil
}
root.Left, root.Right = root.Right, root.Left
invertTree(root.Left)
invertTree(root.Right)
return root
}
func Test1(t *testing.T) {
}