human
Minimum deletions in Array to make difference of adjacent elements non | Function for finding minimum deletions so that the array becomes non decreasing and the difference between adjacent elements also becomes non decreasing.
initialize answer to a large value.
generating all subsets.
checking the first condition.
checking the second condition.
if both conditions are satisfied consider the answer for minimum.
Driver code.
Input.
Function call"
How can the above be solved in Python?
 Give me a code to minimum deletions in Array to make difference of adjacent elements non and the other steps required?
assistant
#Here is code to minimum deletions in Array to make difference of adjacent elements non and the other steps required.
 def minimumDeletions ( A , N ) :
	ans = 10 ** 8
	for i in range ( 1 , ( 1 << N ) ) :
		temp = [ ]
		for j in range ( N ) :
			if ( ( i & ( 1 << j ) ) != 0 ) :
				temp . append ( A [ j ] )
		flag = 0
		for j in range ( 1 , len ( temp ) ) :
			if ( temp [ j ] < temp [ j - 1 ] ) :
				flag = 1
		for j in range ( 1 , len ( temp ) - 1 ) :
			if ( temp [ j ] - temp [ j - 1 ] > temp [ j + 1 ] - temp [ j ] ) :
				flag = 1
		if ( flag == 0 ) :
			ans = min ( ans , N - len ( temp ) )
	return ans
if __name__ == ' _ _ main _ _ ' :
	A = [ 1 , 4 , 5 , 7 , 20 , 21 ]
	N = len ( A )
	print ( minimumDeletions ( A , N ) )