Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order