Mastercard interview question

Algorithms and Data Structures, efficiency