```
class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: bool
"""
if len(nums) == 1:
return target == nums[0]
for i in xrange(0,len(nums)-1):
if nums[i] > nums[i+1]:
break
else:
i += 1
return binarySearch(nums[i+1:]+nums[0:i+1],target)
def binarySearch(nums,target):
n = len(nums)
i,j = 0,n-1
while i <= j :
mid = (i+j)//2
if target > nums[mid]:
i = mid + 1
elif target < nums[mid]:
j = mid - 1
else:
return True
return False
```

Many solutions are doing complicated logic in search function, why not just rotate nums in sorted order and then find the target number? Thank you.