human
Divide an array into k segments to maximize maximum of segment minimums | function to calculate the max of all the minimum segments.
if we have to divide it into 1 segment then the min will be the answer.
If k >= 3 , return maximum of all elements ..
Driver code"
Solution in Python:
 Give me a code to divide an array into k segments to maximize maximum of segment minimums and the other steps required?
assistant
#Here is code to divide an array into k segments to maximize maximum of segment minimums and the other steps required.
 def maxOfSegmentMins ( a , n , k ) :
	if k == 1 :
		return min ( a )
	if k == 2 :
		return max ( a [ 0 ] , a [ n - 1 ] )
	return max ( a )
if __name__ == ' _ _ main _ _ ' :
	a = [ - 10 , - 9 , - 8 , 2 , 7 , - 6 , - 5 ]
	n = len ( a )
	k = 2
	print ( maxOfSegmentMins ( a , n , k ) )