Diagonal Difference

  • + 0 comments

    int diagonalDifference(vector> arr) {

    int a= 0 , b = 0;
    int size = arr.size();
    
    for(int i = 0; i < size; ++i) {
        a += arr[i][i];
        b += arr[size - 1 - i][i];
    }
    
    return abs(a - b);
    

    }