 All Problems
Check if Array Is Sorted and Rotated
easy
arrays
amazon
google

Given an array nums, return true if it could be a sorted array rotated some number of positions, false otherwise.

Example 1:

Input: 3 4 5 1 2
Output: true

Example 2:

Input: 2 1 3 4
Output: false

Input format: Space-separated integers.

Output format: true or false.

Run to check your code against the sample cases, or submit to run every case