Meta Interview Question

Leetcode medium question about matrix