I don't know where go wrong.


  • 0
    F

    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;
    }
    

    };


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.