HF RL Explorer

Spiral Matrix Traversal Algorithm

Spiral Matrix Traversal Algorithm: a task in Terminal-Lego-15k (Harbor dataset). Implement an algorithm that loops through the elements of an NxM matrix in a spiral pattern, starting from the center and moving outward. The coordinates use the center of the matrix as the origin (0, 0).

The task

Implement an algorithm that loops through the elements of an NxM matrix in a spiral pattern, starting from the center and moving outward. The coordinates use the center of the matrix as the origin (0, 0).

Part of PrimeIntellect/Terminal-Lego-15k.