Solved problem #28 (spiral matrix)
More efficient version of problem #28