Biology, asked by mudit6117, 1 year ago

Double the number of cells present in the container. Increase the number of cells in the container by 1. Decrease the number of cells in the container by 1. Geekforgeeks

Answers

Answered by Dhaval1234
1
Minimum Numbers of cells that are connected with the smallest path between 3 given cells

Given coordinates of 3 cells (X1, Y1), (X2, Y2) and (X3, Y3) of a matrix. The task is to find the minimum path which connects all three of these cells and print the count of all the cells that are connected through this path.
Note: Only possible moves are up, down, left and right.

Examples:

Input: X1 = 0, Y1 = 0, X2 = 1, Y2 = 1, X3 = 2 and Y3 = 2
Output: 5
(0, 0), (1, 0), (1, 1), (1, 2), (2, 2) are the required cells.
Input: X1 = 0, Y1 = 0, X2 = 2, Y2 = 0, X3 = 1 and Y3 = 1
Output: 4

Similar questions