Visa Inc. interview question

1 dsa question that was medium level array question