Zilingo interview question

tree top view permutations of array