Skip to content

Commit 38fce5a

Browse files
committed
Runtime: 101 ms (Top 40.82%) | Memory: 43.3 MB (Top 79.80%)
1 parent b2d2419 commit 38fce5a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/algorithms/M/Matrix Diagonal Sum/Matrix Diagonal Sum.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
var diagonalSum = function(mat) {
1+
// Runtime: 101 ms (Top 40.82%) | Memory: 43.3 MB (Top 79.80%)
2+
var diagonalSum = function(mat) {
23
return mat.reduce((acc, matrix, i)=>{
34
const matrixlength = matrix.length-1;
45
return acc += (i !== matrixlength-i) ? matrix[i]+ matrix[matrixlength-i] : matrix[i];

0 commit comments

Comments
 (0)