diagonal difference in java

Solutions on MaxInterview for diagonal difference in java by the best coders in the world

showing results for - "diagonal difference in java"
Kylee
25 Oct 2019
1int leftd=0;
2    int rightd=0;
3    int n=arr.size();
4    for(int i=0;i<n;i++)
5    {
6        leftd+=arr.get(i).get(i);
7        rightd+=arr.get(i).get(n-i-1);
8    }
9    int absd=Math.abs(leftd-rightd);
10    return absd;
11
similar questions
queries leading to this page
diagonal difference in java