private ResultType1 _maxPathSum(TreeNode root) {
        ResultType1 result = new ResultType1();
        if (root == null) {
            return result;
        }
        
        if (root.left == null && root.right == null) {
            result.maxSum = Math.max(result.maxSum, root.val);
            result.singleSum = root.val;
            return result;
        }
        
        ResultType1 left = _maxPathSum(root.left);
        ResultType1 right = _maxPathSum(root.right);
        
        result.singleSum = Math.max(left.singleSum, right.singleSum) + root.val;
        result.singleSum = Math.max(result.singleSum, 0);

        result.maxSum = Math.max(left.maxSum, right.maxSum);
        result.maxSum = Math.max(result.maxSum, root.val + left.singleSum + right.singleSum);
        
        return result;
    }