Pergunta de entrevista da empresa Visa Inc.

2d matrix question from leetcode