human
Minimise the maximum element of N subarrays of size K | Function to choose N subarrays of size K such that the maximum element of subarrays is minimum.
Condition to check if it is not possible to choose k sized N subarrays.
Using binary search.
calculating mid.
Loop to find the count of the K sized subarrays possible with elements less than mid.
Condition to check if the answer is in right subarray.
Driver Code.
Function Call"
How can the above be solved in Python?
 ... Can you provide a code to minimise the maximum element of N subarrays of size K and the other steps required?
assistant
#Here is code to minimise the maximum element of N subarrays of size K and the other steps required.
 def minDays ( arr , n , k ) :
	l = len ( arr )
	left = 1
	right = 1e9
	if ( n * k > l ) :
		return - 1
	while ( left < right ) :
		mid = ( left + right ) // 2
		cnt = 0
		product = 0
		for j in range ( l ) :
			if ( arr [ j ] > mid ) :
				cnt = 0
			else :
				cnt += 1
				if ( cnt >= k ) :
					product += 1
					cnt = 0
		if ( product < n ) :
			left = mid + 1
		else :
			right = mid
	return left
if __name__ == " _ _ main _ _ " :
	arr = [ 1 , 10 , 3 , 10 , 2 ]
	n = 3
	k = 1
	print ( int ( minDays ( arr , n , k ) ) )