Archipelago

Archipelago

Did you know, that Stockholm is a city built on 14 islands, connected by 57 bridges over the two waters Lake Mälaren and the Baltic Sea.

You are given a rectangular map of islands where the number in each island tells how many bridges are connected to it.

example

The object is to connect all islands according to the number of bridges with the following rules:

  • there are no more than two bridges in the same direction;
  • bridges can only be vertical or horizontal and can't cross islands or other bridges;
  • when completed, all island on a map are interconnected by bridges, enabling passage from any island to another.

Your function must return...

You should be an authorized user in order to see the full description and start solving this mission.