You are given a matrix N x M size. Each cell of the matrix contains a random capital letter of English alphabet [“A”..”Z”]. If matrix contains letter “A” in position {i,j} you should substitute all letters in column i and row j with a letter “A”. You can’t use extra memory. The matrix can store only capital letters “A” to “Z” in a cell.


Matrix interview puzzle

Write an algorithm and solution in code (C++/C#/JAVA).

Answers and Comments