Amazon Interview Question

Variation of rotting orange, a DP problem onleetcode