Pregunta de entrevista de Amazon

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