Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution(object):
- def sortedArrayToBST(self, arr):
- def convert(arr,s,e):
- if s>e:return None
- m=(s+e)>>1
- t=TreeNode(arr[m])
- t.left=convert(arr,s,m-1)
- t.right=convert(arr,m+1,e)
- return t
- return convert(arr,0,len(arr)-1)
Advertisement
Add Comment
Please, Sign In to add comment