Wingify interview question

Flatten an array till a particular depth