Incorta interview question

Solve the coming datastructure question?