public int dfs1(TreeNode root){
        if(root == null) return 0;
        int m = root.val;

        int left = dfs1(root.left);
        int right = dfs2(root.right);

        if(left > 0) m += left;
        if(right > 0) m += right;
        max = m > max ? m : max;

        return Math.max(left, right) > 0 ? root.val + Math.max(left, right) : root.val;
    }