Solution partially correct - Please help to figure out the missing part

Can someone please help me to figure out the missing part, as I am getting partially correct message. My code:

public int maxArr(ArrayList A) {
int absMax =0, absSum=0;
int len = A.size();

    for(int i =0; i< len; i++){
        for(int j =i; j< len; j++){
            absSum = Math.abs(A.get(i)-A.get(j)) + Math.abs(i-j);
            absMax = Math.max(absSum, absMax);
        }
    }
    
    return absMax;
}

Your code iss absolutely correct,you are getting this message Partially Correct because time limit is exceeding for certain test cases. we need to solve this problem in O(n) try the hint provided in the Hints section .

Click here to start solving coding interview questions