Репост из: TCS CodeVita Season 12 Solutions
Plague 2050
Python
100% Correct Code ✅
TCS CodeVita Zone 2
https://telegram.me/+_hn3cBQVbGliYTI9
from collections import deque
https://telegram.me/PLACEMENTLELO
def infected_neighbors_count(placementlelo, a, b):
n = len(placementlelo)
count = 0
directions = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]
for i in range(len(directions)):
dx, dy = directions[i]
nx, ny = a + dx, b + dy
if 0
Python
100% Correct Code ✅
TCS CodeVita Zone 2
https://telegram.me/+_hn3cBQVbGliYTI9
from collections import deque
https://telegram.me/PLACEMENTLELO
def infected_neighbors_count(placementlelo, a, b):
n = len(placementlelo)
count = 0
directions = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]
for i in range(len(directions)):
dx, dy = directions[i]
nx, ny = a + dx, b + dy
if 0