```
class Solution(object):
def sortedArrayToBST(self, nums):
"""
:type nums: List[int]
:rtype: TreeNode
"""
if not nums:
return None
length = len(nums)
def recur(s, e, node=False):
if s <= e:
mid = (s + e) / 2
node = TreeNode(nums[mid])
node.left = recur(s, mid - 1)
node.right = recur(mid + 1, e)
return node
else:
return None
root = recur(0, length - 1)
return root
```