Store the rows and columns to be marked as 1 in row [ ] and col [ ] arrays respectively
for i in range ( 0 , R ) : NEW_LINE INDENT for j in range ( 0 , C ) : NEW_LINE INDENT if ( mat [ i ] [ j ] == 1 ) : NEW_LINE INDENT row [ i ] = 1 NEW_LINE col [ j ] = 1 NEW_LINE DEDENT DEDENT DEDENT