private int findSingleBranchMaxPathSum(TreeNode root) {
        int leftMaxPathSum=0;
        int rightMaxPathSum=0;
        if(root.left != null){
            leftMaxPathSum = findSingleBranchMaxPathSum(root.left);
        }
        if(root.right != null){
            rightMaxPathSum = findSingleBranchMaxPathSum(root.right);
        }
        int left = leftMaxPathSum<0?0:leftMaxPathSum;
        int right = rightMaxPathSum<0?0:rightMaxPathSum;
        if(maxPathSum == null){
            maxPathSum = root.val+left+right;
        }else if(root.val+left+right>maxPathSum){
            maxPathSum = root.val+left+right;
        }
        int single = left>right?left:right;
        return root.val+single;
    }