Pregunta de entrevista de TikTok

coding and algorithm questions, medium level.