Pregunta de entrevista de ThoughtSpot

Write a program to flatten an array based on different levels