/**
 * 
 */
package com.wangsus.codetest.difficulty1;

import com.wangsus.codetest.datastructure.TreeNode;

/**
 * @author Su
 * 
 *         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.
 */
public class Minimum_Depth_of_Binary_Tree {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}
	/**
	 * Definition for binary tree
	 * public class TreeNode {
	 *     int val;
	 *     TreeNode left;
	 *     TreeNode right;
	 *     TreeNode(int x) { val = x; }
	 * }
	 */
	public class Solution {
	    public int minDepth(TreeNode root) {
	        return 0;
	    }
	}
}

@@ -679,16 +679,36 @@
 ution %7B%0A
+%09%09int minDepth = 0;%0A
 %09    pub
@@ -750,21 +750,178 @@
     
+%09if(root==null)%7B%0A%09
     
+%09%09
 return 
-0;
+minDepth;%0A%09    %09%7Delse%7B%0A%09    %09%09minDepth++;%0A%09    %09%09minDepth(root.left);%0A%09    %09%09minDepth(root.right);%0A%09    %09%7D%0A%09    %09return minDepth;%0A%09        
 %0A%09  

Minimum Depth of Binary Tree Wrong