Domanda di colloquio di TikTok

A leetcode problem with medium difficulties.