package helper import ( "fmt" ) type ListNode struct { Val int Next *ListNode } type TreeNode struct { Val int Left *TreeNode Right *TreeNode } func abs(x int) int { if x < 0 { return -x } return x } func maxInt(x, y int) int { if x > y { return x } return y } func minInt(x, y int) int { if x < y { return x } return y } func list2str(head *ListNode) string { curr := head str := make([]rune, 0) for curr != nil { str = append(str, rune(curr.Val+'0')) curr = curr.Next } return string(str) } func printTree(root *TreeNode) { if root == nil { return } if root.Left != nil { printTree(root.Left) } if root.Right != nil { printTree(root.Right) } fmt.Print(root.Val, " ") }