Pergunta de entrevista da empresa ThoughtSpot

Write a program to flatten an array based on different levels