MCPcopy Create free account
hub / github.com/austingebauer/go-leetcode / invertTree

Function invertTree

invert_binary_tree_226/solution.go:5–12  ·  view source on GitHub ↗
(root *TreeNode)

Source from the content-addressed store, hash-verified

3import . "github.com/austingebauer/go-leetcode/structures"
4
5func invertTree(root *TreeNode) *TreeNode {
6 if root == nil {
7 return nil
8 }
9
10 root.Left, root.Right = invertTree(root.Right), invertTree(root.Left)
11 return root
12}

Callers 1

Test_invertTreeFunction · 0.85

Calls

no outgoing calls

Tested by 1

Test_invertTreeFunction · 0.68