Amazon interview question

Algorithm questions related to matrix.