Git Product home page Git Product logo

spiralchallenge's Introduction

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 [email protected]

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.

spiralchallenge's People

Contributors

m4tbat avatar

Stargazers

 avatar

Watchers

Renzo G. Pretto avatar Giuseppe Arici avatar  avatar Stefano Zanetti avatar James Cloos avatar Paolo Tagliani avatar  avatar

Forkers

nerthase

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.