Pregunta de entrevista de Extreme Networks

The question is pretty similar to the Leetcode problems