TikTok Interview Question

Medium to hard Data structures