human
Give me a code to find first k natural numbers missing in given array and the other steps required given the following:
Find first k natural numbers missing in given array | Program to print first k missing number.
creating a hashmap.
Iterate over array.
Iterate to find missing element.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to find first k natural numbers missing in given array and the other steps required.
 def printmissingk ( arr , n , k ) :
	d = { }
	for i in range ( len ( arr ) ) :
		d [ arr [ i ] ] = arr [ i ]
	cnt = 1
	fl = 0
	for i in range ( n + k ) :
		if cnt not in d :
			fl += 1
			print ( cnt , end = " ▁ " )
			if fl == k :
				break
		cnt += 1
	print ( )
arr = [ 1 , 4 , 3 ]
n = len ( arr )
k = 3
printmissingk ( arr , n , k )