##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
4 5 0 1 1 0 1 0 1 0 1 0 0 0 0 0 1 0 1 0 0 0
Multiple zombies spread simultaneously. After hour 1, every human adjacent to a zombie is infected. After hour 2, all remaining humans are reached. Answer: 2
2
2 2 1 0 0 1
1
3 3 1 0 0 0 0 0 0 0 0
4
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).
Zombies at and each infect the human diagonally opposite them in one hour. Answer: 1
Single zombie at the top-left corner . The infection spreads outward; the last cell reached is at Manhattan distance . Answer: 4