Google Interview Question

matrix mapping problem (med leetcode)