Python (Simple BFS)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n    def containVirus(self, isInfected):\n        m, n, total = len(isInfected), len(isInfected[0]), 0\n\n        def function(i,j):\n            stack, x_cells, virus, walls = [(i,j)], set(), set(), []\n\n            virus.add((i,j))\n\n            while stack:\n                x,y = stack.pop(0)\n\n                for (nx,ny) in [(x+1,y),(x-1,y),(x,y-1),(x,y+1)]:\n                    if 0 <= nx < m and 0 <= ny < n:\n                        if isInfected[nx][ny] == 0:\n                            walls.append([nx,ny])\n                            x_cells.add((nx,ny))\n                        elif isInfected[nx][ny] == 1 and (nx,ny) not in virus:\n                            virus.add((nx,ny))\n                            stack.append((nx,ny))\n\n            return [x_cells,walls,virus]\n\n        while True:\n            res, visited = [], set()\n\n            for i in range(m):\n                for j in range(n):\n                    if (i,j) not in visited and isInfected[i][j] == 1:\n                        ans = function(i,j)\n                        res.append(ans)\n                        visited |= ans[2]\n\n            if not res:\n                break \n\n            for i in res:\n                if i[1] == []:\n                    break \n\n            res.sort(key = lambda x:-len(x[0]))\n\n            for x,y in res[0][2]:\n                isInfected[x][y] = -1\n\n            for dead in res[1:]:\n                for x,y in dead[0]:\n                    isInfected[x][y] = 1 \n\n            total += len(res[0][1])\n\n        return total\n```
['Python3']