Print a 2D matrix in spiral form
Filed under Snapdeal
The question
Given a 2D matrix, traverse and print all elements in spiral order. Also explain how 2D arrays are laid out in memory.
No write-up yet. Related questions below have one.
Related Snapdeal questions
Collected from public candidate posts and coding forums. Updated Nov 2026.