Amazon Interview Question

How to traverse a matrix in spiral pattern.