TikTok Interview Question

Algorithm Test is Puzzle 9 question