Print a 2D matrix in spiral order of traversal

O(N) solution where N is the number of elements in 2D matrix