Capital One interview question

Leetcode medium-hard Arreglos, matrices mapas