Google interview question

Leet code hard question on 2 dimensional arrays