human
Minimum length of square to contain at least half of the given Coordinates | Function to Calculate the Minimum value of M.
To store the minimum M for each point in array.
Sort the array.
Index at which atleast required point are inside square of length 2 * M.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to minimum length of square to contain at least half of the given Coordinates and the other steps required.
 def findSquare ( n ) :
	points = [ [ 1 , 2 ] , [ - 3 , 4 ] , [ 1 , 78 ] , [ - 3 , - 7 ] ]
	a = [ None ] * n
	for i in range ( 0 , n ) :
		x = points [ i ] [ 0 ]
		y = points [ i ] [ 1 ]
		a [ i ] = max ( abs ( x ) , abs ( y ) )
	a . sort ( )
	index = n // 2 - 1
	print ( " Minimum ▁ M ▁ required ▁ is : " , a [ index ] )
if __name__ == " _ _ main _ _ " :
	N = 4
	findSquare ( N )