'Decodes your encoded data to tree.
:type data: str
:rtype: TreeNode'

def deserialize(self, data):

    def deserializeHelper(minVal, maxVal, vals):
        if (not vals):
            return None
        if (minVal < vals[0] < maxVal):
            val = vals.popleft()
            node = TreeNode(val)
            node.left = deserializeHelper(minVal, val, vals)
            node.right = deserializeHelper(val, maxVal, vals)
            return node
        else:
            return None
    vals = collections.deque([int(val) for val in data.split()])
    return deserializeHelper(float('-inf'), float('inf'), vals)
