Visa Inc. interview question

I create a recursive for loop and then optimized the solution using a dictionary

Glassdoor | Glassdoor