Answer in C++ only Sanjiv Kapoor is a very well-known Chef in India and even in the world. He is planning to plant a flower garden - a n-line grid and columns m. In each cell of this grid, one flower...


Answer in C++ only<br>Sanjiv Kapoor is a very well-known Chef in India and even in the world. He is planning to plant a<br>flower garden - a n-line grid and columns m. In each cell of this grid, one flower is planted; let's say<br>the type of flower planted in a cell (i, ) by ai, j.<br>Today, Sanjiv Kapoor will make a new menu with two dishes: Italian and Chinese. You need to<br>choose as many flowers as possible to decorate the dishes and make them look attractive. Each bowl<br>can only be decorated with flowers of one kind, so he can choose only one or two flowers. Also, Chef<br>Go wants the flowers he chooses to form one connected place, so he can finish his job as soon as<br>possible. Connected area is a group of cells that we can move from any cell to any other cell in this<br>set by simply moving between adjacent cells from the set.<br>Help Sanjiv Kapoor to find the largest connected area in his flower garden that contains at least two<br>types of flowers.<br>Example Input<br>45<br>11 2 3 1<br>3 1 25 2<br>5 2 1 5 6<br>1 3 1 2 1<br>Example Output<br>10<br>

Extracted text: Answer in C++ only Sanjiv Kapoor is a very well-known Chef in India and even in the world. He is planning to plant a flower garden - a n-line grid and columns m. In each cell of this grid, one flower is planted; let's say the type of flower planted in a cell (i, ) by ai, j. Today, Sanjiv Kapoor will make a new menu with two dishes: Italian and Chinese. You need to choose as many flowers as possible to decorate the dishes and make them look attractive. Each bowl can only be decorated with flowers of one kind, so he can choose only one or two flowers. Also, Chef Go wants the flowers he chooses to form one connected place, so he can finish his job as soon as possible. Connected area is a group of cells that we can move from any cell to any other cell in this set by simply moving between adjacent cells from the set. Help Sanjiv Kapoor to find the largest connected area in his flower garden that contains at least two types of flowers. Example Input 45 11 2 3 1 3 1 25 2 5 2 1 5 6 1 3 1 2 1 Example Output 10

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here