Visa Inc. Interview Question

HackerRank question