Question d’entretien chez Amazon

Algorithm question: To print n by m dimensional matrix in spiral way.