Mastercard Interview Question

I was given a technical assignment to complete