Amazon interview question

How to traverse a matrix in spiral pattern.