Amazon interview question

a matrix mutation question and critical connection