Globant interview question

write custom logic to flatten an array