Visa Inc. Interview Question

Write a reduce function, both with and without recursion.