You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

429 B

invert tree

Instructions

Write a function that takes tree and inverts(flips) and returns it.

Expected function and structure

type TNode struct {
    Val     int
    Left    *TNode
    Right   *TNode
}

func InvertTree(root *TNode) *TNode {

}

Example:

Input:
      7
    /   \
   5     10
  / \    / \
 3   6  9  13

Output:
        7
     /    \
   10      5
  / \     / \
13   9   6   3