Pregunta de entrevista de Meta

Mostly Leetcode medium to hard question