I have an interview with bloomberg and met a non-leetcode problem.
The Input is given as a 2D matrix with True and False values, a interger variable n representing the number of iteration.
The output should print the pattern in n-th iteration. The iteration follow the following rules:
Each X representing a True Value and a Blank represents False. In n-th each iteration, the true value of (n-1)-th iteration will be replaced by a copy of entire n-1 iteration itself.
XXX XXX XXX
X X X X X X
XXX XXX XXX
XXX XXX XXX
X X -> X X X X -> ...
XXX XXX XXX
XXX XXX XXX
X X X X X X
XXX XXX XXXI truely have no better idea to solve it. During the interview, I was saying that creating the matrix again and again and do sime kind of simulation. Could anyone help?