Pergunta de entrevista da empresa think-cell

Data structures question, coding challenge