Waabi interview question

Coding similar to 2D Grid Leetcode