标签:c style class blog code java
第一次看到accept,心里有点小开心
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { void show(List<Integer> li,TreeNode p){ if(p!=null){ li.add(p.val); show(li,p.left); show(li,p.right); } } public List<Integer> preorderTraversal(TreeNode root) { List<Integer> li = new ArrayList<Integer>(); show(li,root); return li; } }
Binary Tree Preorder Traversal,布布扣,bubuko.com
Binary Tree Preorder Traversal
标签:c style class blog code java
原文地址:http://www.cnblogs.com/HeyJuice/p/3778987.html