Problem 2855 · Easy

Minimum Right Shifts to Sort the Array

A rotation can sort the array only if it has at most one descent and the last value is not above the first; the shift count is the distance from that descent to the end.

Open the interactive visualisation