Pergunta de entrevista da empresa Chewy

Basic Data structure based problem