Problems > Rotated but Sorted > Editorial

Rotated but Sorted — Solution & Editorial

Back to the Problem

Count circular descents (positions where ai > ai+1, wrapping around): a rotation of sorted has at most one.

Complexity: O(N)