TikTok Interview Question

Just one to two algorithm questions.