human
Minimize operations to delete all elements of permutation A by removing a subsequence having order as array B | Function to find the minimum number of operations to delete all elements of permutation A in order described by B.
Stores the count of operations.
Stores the index of current integer in B to be deleted.
Loop to iterate over all values of B.
Stores the current index in A.
Iterate over all values A.
If current integer of B and A equal , increment the index of the current integer of B.
As the permutation A has been traversed completely , increment the count of operations by 1.
Return Answer.
Driver Code"
Solution in Python:
 Write me a code to minimize operations to delete all elements of permutation A by removing a subsequence having order as array B and the other steps required?
assistant
#Here is code to minimize operations to delete all elements of permutation A by removing a subsequence having order as array B and the other steps required.
 def minOperations ( A , B , N ) :
	cnt = 0
	i = 0
	while ( i < N ) :
		j = 0
		while ( j < N and i < N ) :
			if ( B [ i ] == A [ j ] ) :
				i += 1
			j += 1
		cnt += 1
	return cnt
if __name__ == ' _ _ main _ _ ' :
	A = [ 2 , 4 , 6 , 1 , 5 , 3 ]
	B = [ 6 , 5 , 4 , 2 , 3 , 1 ]
	N = len ( A )
	print ( minOperations ( A , B , N ) )