':type s: str
:rtype: TreeNode'

def str2tree(self, s):

    def str2treeHelper(s, i):
        start = i
        if (s[i] == '-'):
            i += 1
        while ((i < len(s)) and s[i].isdigit()):
            i += 1
        node = TreeNode(int(s[start:i]))
        if ((i < len(s)) and (s[i] == '(')):
            i += 1
            (node.left, i) = str2treeHelper(s, i)
            i += 1
        if ((i < len(s)) and (s[i] == '(')):
            i += 1
            (node.right, i) = str2treeHelper(s, i)
            i += 1
        return (node, i)
    return (str2treeHelper(s, 0)[0] if s else None)
