Media.net Interview Question

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