Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

matrix elements sum javascript

function solution(matrix) {
    let s = 0;
    for (var i = 0; i < matrix.length; i++) {
        for (var j = 0; j < matrix[0].length; j++) {
            if (matrix[i][j] == 0 && i+1 < matrix.length) {
                matrix[i+1][j] = 0;
            }
            s += matrix[i][j]
        }
    }
    return s
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript get uploaded file name 
Javascript :: express draft 
Javascript :: : not foundram Files/nodejs/npm: 3: 
Javascript :: find min and max date in array javascript 
Javascript :: how to add sticky function in javascript 
Javascript :: jquery disable form element 
Javascript :: how to make a bot react to own message js 
Javascript :: regex for yyyy-mm-dd 
Javascript :: js go back 
Javascript :: javascript get first letter of each word 
Javascript :: make js file windows command 
Javascript :: npm 
Javascript :: how to get data from ipfs 
Javascript :: kill node process 
Javascript :: js remove all objects from array where value 
Javascript :: discord.js send text in different channel on server 
Javascript :: javascript canvas dot 
Javascript :: ajax data and image upload laravel 
Javascript :: give div event listener functional component 
Javascript :: How to clear localStorage when browser/tab is closing 
Javascript :: get unchecked checkbox jquery 
Javascript :: get attribute href 
Javascript :: remove after js 
Javascript :: redirect using javascript 
Javascript :: render html in node js 
Javascript :: javascript get x,y point on circle 
Javascript :: enzyme debug 
Javascript :: react next alias import 
Javascript :: too many open files react native 
Javascript :: how to copy text in the clipboard in js 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =