题目一: 

  求一个二叉树的最小深度。

Given a binary tree, find its minimum depth. The minimum depth is the number of nodes aong the shortest path from the root node down to the neartest leaf node.

  TreeNode类:

public class TreeNode<T> {

    public T val;
    public TreeNode<T> left = null;
    public TreeNode<T> right = null;
    public TreeNode<T> parent = null;

    public TreeNode(T val) {
        this.val = val;
    }

}
View Code

相关文章: