Explorar el Código

fixed readme

master
Thorn Avery hace 4 años
padre
commit
d935e95106
Se han modificado 1 ficheros con 11 adiciones y 1 borrados
  1. +11
    -1
      README.md

+ 11
- 1
README.md Ver fichero

@@ -5,15 +5,25 @@ bad attempts at solving interview questions
## The Problem - Verbatim ## The Problem - Verbatim


Write a small program which: Write a small program which:

accepts on the command line an odd number N accepts on the command line an odd number N

outputs a sequence of numbers corresponding to the following steps: outputs a sequence of numbers corresponding to the following steps:

the numbers 1 through N^2 are written in a grid the numbers 1 through N^2 are written in a grid

the first number in the sequence is the number in the center of the grid the first number in the sequence is the number in the center of the grid

the subsequent numbers are found by spiraling out clockwise, starting to the right the subsequent numbers are found by spiraling out clockwise, starting to the right

For example, for N = 3 we have the grid: For example, for N = 3 we have the grid:

```
1 2 3 1 2 3
4 5 6 4 5 6
7 8 9 7 8 9
```

So we start with 5, head right to 6, then down to 9, left through 8 and 7, up through 4 and 1 and finally right through 2 and 3. This gives the output: So we start with 5, head right to 6, then down to 9, left through 8 and 7, up through 4 and 1 and finally right through 2 and 3. This gives the output:
5, 6, 9, 8, 7, 4, 1, 2, 3, end 5, 6, 9, 8, 7, 4, 1, 2, 3, end


@@ -26,5 +36,5 @@ IMPORTANT: your solution should not make use of arrays or matrices of numbers. I


``` ```
ghc -02 -Wall Spiral.hs -o spiral ghc -02 -Wall Spiral.hs -o spiral
spiral
./spiral
``` ```

Cargando…
Cancelar
Guardar