human
Check if all array elements are present in a given stack or not | Function to check if all array elements is present in the stack.
Store the frequency of array elements.
Loop while the elements in the stack is not empty.
Condition to check if the element is present in the stack.
Driver Code"
Solution in Python:

Write me a code to check if all array elements are present in a given stack or not and the other steps required?
assistant
#Here is code to check if all array elements are present in a given stack or not and the other steps required.
 def checkArrInStack ( s , arr ) :
	freq = { }
	for ele in arr :
		freq [ ele ] = freq . get ( ele , 0 ) + 1
	while s :
		poppedEle = s . pop ( )
		if poppedEle in freq :
		freq [ poppedEle ] -= 1
		if not freq [ poppedEle ] :
			del freq [ poppedEle ]
	if not freq :
		return True
	return False
if __name__ == " _ _ main _ _ " :
	s = [ 10 , 20 , 30 , 40 , 50 ]
	arr = [ 20 , 30 ]
	if checkArrInStack ( s , arr ) :
		print ( " YES " )
	else :
		print ( " NO " )