Pregunta de entrevista de Media.net

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