## Question 1 What is the output if the following $(3 \times 3)$ grid is given as input? $$ \begin{bmatrix} 2 & 1 & 1 \\ 0 & 0 & 1 \\ 1 & 1 & 1 \end{bmatrix} $$ ### Options 1. 3 Incorrect ---------------------------- 2. 6 Correct Starting from cell 2 at coordinate (0, 0), the process of rotting oranges travels right all the way to cell (3, 1). This traversal takes 6 minutes to rot all of the oranges. ---------------------------- 3. 4 Incorrect ---------------------------- --------------------------------------------- ## Question 2 What is the output if the following $(3 \times 3)$ grid is given as input? $$ \begin{bmatrix} 0 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \end{bmatrix} $$ ### Options 1. -1 Correct There’s no rotten orange in the grid to begin with, so it is not possible for an orange to be rotten. ---------------------------- 2. 2 Incorrect ---------------------------- 3. 1 Incorrect ---------------------------- --------------------------------------------- ## Question 3 What is the output if the following $(3 \times 3)$ grid is given as input? $$ \begin{bmatrix} 1 & 1 & 1 \\ 1 & 2 & 1 \\ 1 & 1 & 1 \end{bmatrix} $$ ### Options 1. 1 Incorrect ---------------------------- 2. 2 Correct Starting from the rotten orange at coordinate (1, 1), all of the adjacent cells will get rotten, this would take 1 minute, and then all the remaining corner cells will rot, this would take another minute. So, a total of 2 minutes are required to rot all the oranges. ---------------------------- 3. 5 Incorrect ---------------------------- ---------------------------------------------