Visa Inc. interview question

Algo question.