Google interview question

Variant of Spiral Matrix Leetcode