TikTok Interview Question

write fn to flatten array, hook to debounce