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
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.