BonAmi Software interview question

Write code to flatten nested list