trying to work out a clever algorithm

To convert diagonals to arrays