Microsoft Interview: transforming a matrix

后端 未结 5 2102
伪装坚强ぢ
伪装坚强ぢ 2021-01-30 11:37

Given a matrix of size n x m filled with 0\'s and 1\'s

e.g.:

1 1 0 1 0

0 0 0 0 0

0 1 0 0 0

1 0 1 1 0

if the matrix has 1 a

5条回答
  •  灰色年华
    2021-01-30 12:39

    public void setOnes(int [][] matrix){
    
        boolean [] row = new boolean [matrix.length]
        boolean [] col = new boolean [matrix[0].length]
        for (int i=0;i

提交回复
热议问题