# The least efficient way of connecting a 3x3 grid of dots

Browsing Reddit I found this interesting submission which caught my attention because it seemed like a fun little project to complete.

I reverted to type and wrote up a script in CoffeeScript which you can find at the Github repository. Must try harder to use Elixir for these - maybe the next thing I can do is re-write it in Elixir.

There were a few false starts, but I think the final solution is pretty solid and seems to give the same sort of results as expected.

So for the grid:

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

The least efficient way to connect all the numbers is:

```
[ 2, 7, 6, 1, 8, 3, 4, 9, 5 ]
```

with a length of 17.066689404871624. Obviously there's a bunch of other similar paths, but none are any longer at least according to my calculations.

And that's what I learnt today!