Solved search in rotated sorted array problem