Check if Array is Sorted and Rotated
Easy
Arrays
Array
Return true if array was sorted then rotated (possibly 0 times).
Constraints
1 ≤ len ≤ 100
Examples
Example 1:
Input: 3 4 5 1 2
Output: true
Example 2:
Input: 2 1 3 4
Output: false
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console