Given an integer array nums, rotating the array by an integer k (where k nums.length) shifts each element to the left cyclically by k positions.
For any given rotation k, a score is calculated as the number of indices i where nums[i] i.
Return the rotation index k that yields the maximum possible score. If there are multiple values of k that achieve the maximum score, return the smallest such k.
Constraints:
nums.length
nums[i] nums.length
Given an integer array nums, rotating the array by an integer k (where k nums.length) shifts each element to the left cyclically by k positions.
For any given rotation k, a score is calculated as the number of indices i where nums[i] i.
Return the rotation index k that yields the maximum possible score. If there are multiple values of k that achieve the maximum score, return the smallest such k.
Constraints:
nums.length
nums[i] nums.length