Pergunta de entrevista da empresa ENGIE

Flatten a deeply nested array with certain conditions on naming schema