Pregunta de entrevista de Propelled Brands

A coding question based on DS algo.