Pregunta de entrevista de TikTok

Standard Leetcode hard questions, around algorithms