Visa Inc. interview question

typical algorithm questions from leetcode