You are viewing a single comment's thread. Return to all comments →
Did the same in Java [ O(n) time complexity ]:
for(int i=0; i<n; i++){ sum1+=arr[i][i]; sum2+=arr[i][n-1-i]; } System.out.println(Math.abs(sum1-sum2));
Seems like cookies are disabled on this browser, please enable them to open this website
Diagonal Difference
You are viewing a single comment's thread. Return to all comments →
Did the same in Java [ O(n) time complexity ]: