## Question 1 What is the correct output for the following input values? $$grid = \begin{matrix} [1, 1, 0, 1] \\ [0, 1, 1, 1] \\ [1, 0, 0, 1] \\ [1, 1, 1, 1] \end{matrix} ,\space sr = 1,\space sc = 3,\space target = 3 $$ ### Options 1. $$ \begin{matrix} [2, 2, 0, 2] \\ [0, 2, 2, 2] \\ [2, 0, 0, 2] \\ [2, 2, 2, 2] \end{matrix} $$ Incorrect ---------------------------- 2. $$ \begin{matrix} [3, 3, 0, 3] \\ [0, 3, 3, 3] \\ [3, 0, 0, 3] \\ [3, 3, 3, 3] \end{matrix} $$ Correct Each cell of the grid will be affected since they’re connected adjacently to each other and have the same value as the starting cell. ---------------------------- 3. $$ \begin{matrix} [1, 1, 0, 3] \\ [0, 0, 3, 3] \\ [3, 0, 0, 3] \\ [3, 3, 3, 3] \end{matrix} $$ Incorrect ---------------------------- --------------------------------------------- ## Question 2 What is the correct output for the following input values? $$grid = \begin{matrix} [1, 0, 2] \\ [0, 2, 1] \\ [2, 0, 1] \\ [1, 2, 1] \end{matrix} ,\space sr = 1,\space sc = 2,\space target = 3 $$ ### Options 1. $$ \begin{matrix} [1, 0, 2] \\ [0, 2, 3] \\ [1, 0, 3] \\ [1, 2, 3] \end{matrix} $$ Incorrect ---------------------------- 2. $$ \begin{matrix} [1, 0, 2] \\ [0, 2, 3] \\ [2, 0, 1] \\ [1, 2, 3] \end{matrix} $$ Incorrect ---------------------------- 3. $$ \begin{matrix} [1, 0, 2] \\ [0, 2, 3] \\ [2, 0, 3] \\ [1, 2, 3] \end{matrix} $$ Correct The given coordinates $[1, 2]$ point at cell value $1$ of the original grid. The $1$s in the last column are the only ones affected since all three are connected adjacently, and no other cell has the same initial value. ---------------------------- --------------------------------------------- ## Question 3 What is the correct output for the following input values? $$grid = \begin{matrix} [5, 2, 4] \\ [4, 4, 7] \\ [3, 4, 6] \end{matrix} ,\space sr = 2,\space sc = 2,\space target = 0 $$ ### Options 1. $$ \begin{matrix} [5, 2, 4] \\ [4, 4, 7] \\ [3, 4, 0] \end{matrix} $$ Correct There are no other cells that match the same starting value as $6$, so only $1$ cell will be affected. ---------------------------- 2. $$ \begin{matrix} [5, 2, 0] \\ [0, 0, 6] \\ [3, 0, 6] \end{matrix} $$ Incorrect ---------------------------- 3. $$ \begin{matrix} [5, 2, 4] \\ [4, 4, 7] \\ [3, 4, 6] \end{matrix} $$ Incorrect ---------------------------- ---------------------------------------------