Skip to content

pragmamark/SpiralChallenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spiral Algorithm Challenge

Instructions

Objective

Devise and implement an algorithm to fill a 2-dimensional grid of size N with numbers from 1 to N so that they form a spiral, starting from one corner of the grid.

Here's an example of a 10x10 grid:

1   2 	3  	4  	5  	6  	7  	8  	9  	10
36	37	38	39	40	41	42	43	44	11
35	64	65	66	67	68	69	70	45	12
34	63	84	85	86	87	88	71	46	13
33	62	83	96	97	98	89	72	47	14
32	61	82	95	100	99	90	73	48	15
31	60	81	94	93	92	91	74	49	16
30	59	80	79	78	77	76	75	50	17
29	58	57	56	55	54	53	52	51	18
28	27	26	25	24	23	22	21	20	19

Steps

  • clone the repo;
  • implement the body of the function fill in main.swift;
  • make sure the unit tests pass;
  • zip the project and send it over to info@pragmamark.org

Evaluation

We'll evaluate all solutions received before the deadline and award the best (as in: most elegant, nice, readable, pleasantly surprising) one.

License

The code is released under the MIT License. See the LICENSE file for more info.

About

Spiral Algorithm Challenge

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages