Pregunta de entrevista de Amazon

Data Structures - Leet Code pattern but different