Meta interview question

Leetcode matrix problem, pretty hard