public void visit(TreeNode node, int now, int depth){
    	visited[depth++] = node.val;
    	if(now + node.val == sum && node.left == null && node.right == null){
    		ArrayList<Integer> one = new ArrayList<Integer>(depth);
    		for(int i = 0; i < depth; i++) one.add(visited[i]);
    		res.add(one);
    	}
    	if(node.left != null) visit(node.left, now + node.val, depth);
    	if(node.right != null) visit(node.right, now + node.val, depth);
    }