TikTok Interview Question

For coding qn, flatten an array + remove duplicated elements