Media.net interview question

Check if array is sorted and rotated(asked to optimize)