Question d’entretien chez Pinterest

some algorithm question using matrix