Skip to main content
Go to Latest
File
package maximum_depth_of_binary_tree
import serialize_and_deserialize_binary_tree "github.com/masx200/leetcode-test/serialize-and-deserialize-binary-tree"
type TreeNode = serialize_and_deserialize_binary_tree.TreeNode
func maxDepth(root *TreeNode) int { if root == nil { return 0 } else { return max(maxDepth(root.Left), maxDepth(root.Right)) + 1 }}func max(a, b int) int { if a > b { return a } return b}