Max Sum In The Configuration
medium
1. Given an array, you have to find the max sum of i*A[i] where A[i] is the element at index i in the array. 2. The only operation allowed is to rotate(clock-wise or counter clock-wise) the array any number of times.
Constraints
1 <= N <= 10^6 1 <= arr[i] <= 10^5
Format
Input
Input is managed for you
Output
Output is managed for you
Example
Sample Input
4
8 3 1 2
Sample Output
29
Question Video