Wingify Interview Question

Flatten an array till a particular depth