Answer: Infosys OA Question 2024 September | Matrix | on-campus
Answer · Posted Jun 2026
Solution: Spiral Matrix — Layer-by-Layer Boundary Simulation Approach We simulate the spiral traversal using four boundary pointers: top, bottom, left, right. At each step we traverse one full layer: Left → Right along the top row, then increment top. Top → Bottom along the right column, then decrement right. Right → Left along the bottom row (if top <= bottom), then decrement bottom. Bottom → Top along the left column (if left <= right), then increment left. We repeat until ...
The full answer & interview discussion are available to premium members.
Log in Create a free account