human
Can you provide a code to farthest cell from a given cell in a Matrix and the other steps required given the following:
Farthest cell from a given cell in a Matrix | Function to find the farthest cell distance from the given cell.
From cell ( N , M ).
From Cell ( 1 , 1 ).
From cell ( N , 1 ).
From cell ( 1 , M ).
Finding out maximum.
Prthe answer.
Driver Code"
Solution in Python:
assistant
#Here is code to farthest cell from a given cell in a Matrix and the other steps required.
 def farthestCellDistance ( N , M , R , C ) :
	d1 = N + M - R - C ;
	d2 = R + C - 2 ;
	d3 = N - R + C - 1 ;
	d4 = M - C + R - 1 ;
	maxDistance = max ( d1 , max ( d2 , max ( d3 , d4 ) ) ) ;
	print ( maxDistance ) ;
if __name__ == ' _ _ main _ _ ' :
	N = 15 ;
	M = 12 ;
	R = 1 ;
	C = 6 ;
	farthestCellDistance ( N , M , R , C ) ;