Pergunta de entrevista da empresa Allen Institute for AI

Write a function to traverse a multi-dimensional array in a spiral pattern.