You are viewing a single comment's thread. Return to all comments →
My Java Solution:
int rowSize = arr.size(); int leftSum = IntStream.range(0, rowSize) .map(i -> arr.get(i).get(i)) .sum(); int rightSum = IntStream.range(0, rowSize) .map(i -> arr.get(i).get(rowSize - (1 + i))) .sum(); return Math.abs(leftSum - rightSum);
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 →
My Java Solution: