Indeed Interview Question

It was a leetcode 2D algo question