Pregunta de entrevista de Meta

Leetcode 1284 was the question