import java.util.ArrayList;
public class Solution {
ArrayList<integer> list=new ArrayList<integer>();
public ArrayList<integer> preorderTraversal (TreeNode root) {
if(root!=null) {list.add(root.val);preorderTraversal (root.left);preorderTraversal (root.right);}
return list;
}
}</integer></integer></integer>