create empty set that stores the visiting element of array . Refer below post for details of unordered_set https : www . geeksforgeeks . org / unorderd_set - stl - uses /
unordered_set < int > s ; for ( int i = 0 ; i < n ; i ++ ) {