Java: How to optimize the maximum value of i*a[i] after rotating the array?
I am trying to solve a problem where I need to find the maximum value of the sum of i*a[i] for all 0 <= i <= n-1, where a[i] is the element at index i in the array. The only allowed operation is to rotate the array (clockwise or counterclockwise) any number of times.