Pergunta de entrevista da empresa Mission Lane

Standard leetcode DS question for the first technical round