https://github.com/ericdude4/matrix_traversal
Traverse through an n by n matrix in a spiral pattern, outputting coordinates at each location
https://github.com/ericdude4/matrix_traversal
Last synced: 10 months ago
JSON representation
Traverse through an n by n matrix in a spiral pattern, outputting coordinates at each location
- Host: GitHub
- URL: https://github.com/ericdude4/matrix_traversal
- Owner: ericdude4
- Created: 2020-10-07T03:14:52.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-07T16:24:34.000Z (over 5 years ago)
- Last Synced: 2025-08-10T07:12:44.813Z (10 months ago)
- Language: Elixir
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Matrix traversal
`cd` into this directory and run in an interactive elixir session with `iex -S mix`
```elixir
Matrix.traverse(5)
> (0, 0), (1, 0), (2, 0), (3, 0), (4, 0), (4, 1), (4, 2), (4, 3), (4, 4), (3, 4), (2, 4), (1, 4), (0, 4), (0, 3), (0, 2), (0, 1), (1, 1), (2, 1), (3, 1), (3, 2), (3, 3), (2, 3), (1, 3), (1, 2), (2, 2), finish
```