Maximum time required for all patients to get infected
Given a matrix arr[][], consisting of only 0, 1, and 2, that represents an empty ward, an uninfected patient, and an infected patient respectively. In one unit of time, an infected person at index (i, j) can infect an uninfected person adjacent to it i.e., at index (i - 1, j), (i + 1, j), (i, j - 1), and (i, j + 1). The task is to find the minimum