Domanda di colloquio di Capital One

Justify using one data structure over the other for this problem.