1752. Check if Array Is Sorted and Rotated
Given an array
nums, returntrueif the array was originally sorted in non-decreasing order, then rotated some number of positions (including zero). Otherwise, returnfalse.There may be duplicates in the original array.
Note: An array
Arotated byxpositions results in an arrayBof the same length such thatA[i] == B[(i+x) % A.length], where%is the modulo operation.
1 | class Solution { |