TikTok interview question

For coding qn, flatten an array + remove duplicated elements