solve search in rotated sorted array in o(n)