← Microsoft questions

Spiral traversal of a matrix from any corner in both directions

Filed under Microsoft

Given a 2D matrix, write an algorithm to traverse and print its elements in spiral order, supporting both clockwise and counter-clockwise directions starting from any of the four corners (top-left…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Microsoft questions

Collected from public candidate posts and coding forums. Updated Nov 2026.