Outward Counterclockwise Spiral Matrix Traversal - Haskell


Write a function that accepts four arguments. The first two arguments are the size of the grid (rows X columns), filled with ascending integers from left to right, top to bottom, starting from 1. The next two arguments are the starting positions, the row r and column c.

Return an array of integers obtained by spiraling outward anti-clockwise from the r and c, starting upward.

More details here

My attempt in Haskell.

Related Articles