Find all numbers in range [ 1 , N ] that are not present in given Array | Function to find the missing numbers ; Traverse the array arr [ ] ; Update ; Traverse the array arr [ ] ; If Num is not present ; Given Input ; Function Call
def getMissingNumbers ( arr ) : NEW_LINE INDENT for num in arr : NEW_LINE INDENT arr [ abs ( num ) - 1 ] = - ( abs ( arr [ abs ( num ) - 1 ] ) ) NEW_LINE DEDENT for pos , num in enumerate ( arr ) : NEW_LINE INDENT if num > 0 : NEW_LINE INDENT print ( pos + 1 , end = ' ▁ ' ) NEW_LINE DEDENT DEDENT DEDENT arr = [ 5 , 5 , 4 , 4 , 2 ] NEW_LINE getMissingNumbers ( arr ) NEW_LINE