Official algorithmic problem description and constraints.
Mocha likes arrays, so before her departure, Bazoka gave her an array π consisting of π positive integers as a gift.
Now Mocha wants to know whether array π could become sorted in non-decreasing order after performing the following operation some (possibly, zero) times:
Detailed video explanations, mathematical intuition, and clean C++ implementation code.