Apple Interview Question

Leetcode easy 2D array problem