Houzz interview question

Flatten an array