class Solution {

public:

int maxRotateFunction(vector<int>& A) {

long max;

```
int j=0;
int len=A.size();
for(int j=0;j<len;j++)
{
int temp=0;
for(int k=0;k<len;k++)
{
temp+=k*A[(k+len-j)%len];
}
if(temp>max)
{
max=temp;
}
}
return max;
}
```

};