recursive solution to spiralOrderAlt