Mastercard Interview Question

he asked me some queries to write