/**
* Definition for a binary tree node.
* type TreeNode struct {
* Val int
* Left *TreeNode
* Right *TreeNode
* }
*/funcminDepth(root*TreeNode)int{ifroot==nil{return0}lDepth:=minDepth(root.Left)rDepth:=minDepth(root.Right)ifroot.Left==nil{returnrDepth+1}ifroot.Right==nil{returnlDepth+1}returnmin(lDepth,rDepth)+1}funcmin(a,bint)int{ifa<b{returna}returnb}