public static int minDepth(TreeNode root) {
        if(root == null){
        	return 0;
        }
        int leftMin = minDepth(root.left)+1;
        int rightMin = minDepth(root.right)+1;
    	if(root.left == null && root.right != null){
    		return rightMin;
    	}else if(root.right == null && root.left != null){
    		return leftMin;
    	}
        return leftMin<rightMin?leftMin:rightMin;
    }