Solve the spiral matrix problem by visiting each cell one by one, two level of loops, the first loop counts the number of spirals and the second loop counts the number of elements in one level of spiral.