human
Check whether an array can be fit into another array rearranging the elements in the array | Returns true if the array A can be fit into array B , otherwise false.
Sort both the arrays.
Iterate over the loop and check whether every array element of A is less than or equal to its corresponding array element of B.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to check whether an array can be fit into another array rearranging the elements in the array and the other steps required.
 def checkFittingArrays ( A , B , N ) :
	A = sorted ( A )
	B = sorted ( B )
	for i in range ( N ) :
		if ( A [ i ] > B [ i ] ) :
			return False
	return True
A = [ 7 , 5 , 3 , 2 ]
B = [ 5 , 4 , 8 , 7 ]
N = len ( A )
if ( checkFittingArrays ( A , B , N ) ) :
	print ( " YES " )
else :
	print ( " NO " )