Amazon Interview Question

a matrix mutation question and critical connection