Last active
May 10, 2021 14:19
-
-
Save RahmatSaeedi/a8b1da2422f8b3b5b666734e4f98cde6 to your computer and use it in GitHub Desktop.
CodeSignal - Arcade - Intro - JS - matrixElementsSum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function matrixElementsSum(matrix) { | |
let sum = 0 ; | |
for(let j = 0; j < matrix[0].length; j++) { | |
let i = 0; | |
while(i < matrix.length && matrix[i][j] != 0 ){ | |
sum += matrix[i][j]; | |
i++; | |
} | |
} | |
return sum; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment