Store all the elements in the map to use map as hash for finding elements in O ( 1 ) time .
occ = dict ( ) NEW_LINE for i in range ( n ) : NEW_LINE INDENT occ [ arr [ i ] ] = True NEW_LINE DEDENT isPairFound = False NEW_LINE for i in range ( n ) : NEW_LINE