Visa Inc. Interview Question

Asked to build a function.