iterative solution to spiralOrder