Pregunta de entrevista de Meta

Leetcode style problems with followup