Loading repovive.com/problems/faang/3
This problem is based on an Amazon interview problem described here.
You are given an grid where each cell contains either a zombie () or a human ().
Every hour, all zombies simultaneously infect their adjacent humans. A zombie can infect the human directly up, down, left, or right of it (not diagonally).
Return the number of hours until no humans remain on the grid, or if it is impossible (i.e., there are humans but no zombies to infect them).
Thus it takes 4 hours