C++ passed or not?


#1

Please tell me this is correct or not. Im new to this platform and even it said correct answer I got 115 out of 150. Maybe some test cases didnt pass, I presume but at the same time I didnt find any message like ‘wrong answer for this input’.

int Solution::coverPoints(vector &A, vector &B) {
int sz = A.size();
if(sz == 1) return 0;

    int minSteps = 0;
    
    for(int i = 1; i < sz; i++){
        int x = abs(A[i-1] - A[i]);
        int y = abs(B[i-1] - B[i]);
        minSteps += max(x, y);
    }
    
    
    return minSteps;
}