Skip to content

Instantly share code, notes, and snippets.

@RahmatSaeedi
Last active May 10, 2021 14:19
Show Gist options
  • Save RahmatSaeedi/a8b1da2422f8b3b5b666734e4f98cde6 to your computer and use it in GitHub Desktop.
Save RahmatSaeedi/a8b1da2422f8b3b5b666734e4f98cde6 to your computer and use it in GitHub Desktop.
CodeSignal - Arcade - Intro - JS - matrixElementsSum
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