TikTok Interview Question

3 cases from Hackranking must finish in 2hours