a*********8 发帖数: 140 | 1 用recursion和post order的stack,做第一题:
class TreeNode2 {
char val;
TreeNode2 left;
TreeNode2 right;
TreeNode2(char val){
this.val = val;
}
}
public class Exercise2 {
public List pathRootToLeaf(TreeNode2 root){
List list = new ArrayList();
if (root == null){
return list;
}
List left = pathRootToLeaf(root.left);
List right = pathRootToLeaf(root.right);
i... 阅读全帖 |
|