Left Rotation to a Strictly Increasing Array
Problem statement
Given a nonempty integer array numbers, return how many cyclic left shifts make it strictly increasing.
If no cyclic left rotation works, return -1. Return the unique valid shift when one exists.
Function
rotationToIncreasing(numbers: int[]) → intExamples
Example 1
numbers = [3,4,5,1,2]return = 3Rotating left by three produces [1,2,3,4,5].
Example 2
numbers = [1,2,3]return = 0The array is already strictly increasing.
Constraints
1 <= numbers.length <= 100000