Pergunta de entrevista da empresa Extreme Networks

The question is pretty similar to the Leetcode problems