Question

Write a function that sets the row and column to 1?

Login to Submit

Examples

A matrix 

1 2 3
4 5 6
7 8 9

is represented using JavaScript arrays as [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

If a cell contains 1 then that row and column needs to be all 1s.

The answer would be

1 1 1
1 5 6
1 8 9

which is [[1, 1, 1], [1, 5, 6], [1, 8, 9]]