// Given a binary tree, find its minimum depth.

// The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.

/**
 * Definition for a binary tree node.
 * function TreeNode(val) {
 *     this.val = val;
 *     this.left = this.right = null;
 * }
 */

/**
 * @param {TreeNode} root
 * @return {number}
 */

@@ -352,12 +352,243 @@
 number%7D%0A */%0A
+%0Avar minDepth = function(root) %7B%0A    if( root === null ) return 0;%0A    var left = minDepth(root.left),%0A        right = minDepth(root.right);%0A    return (left === 0 %7C%7C right === 0) ? left + right + 1: Math.min( left,right ) + 1;%0A%7D;%0A

add solution