Diagonal Difference

  • + 0 comments
     public static int diagonalDifference(List<List<Integer>> arr) {
        int result = 0; 
        for(int i = 0; i<arr.size(); i++){
           result +=  arr.get(i).get(i) - arr.get(i).get(arr.size() -i - 1);
        }
        return Math.abs(result);
        }