用DFS完成
int minDepth(TreeNode* root) {
if(!root) return 0;
if(!root->left&&!root->right) return 1;
if(root->left==NULL) return 1+minDepth(root->right);
else if(root->right==NULL) return 1+minDepth(root->left);
else return 1+min(minDepth(root->left),minDepth(root->right));
}