Skip to content

Commit

Permalink
Merge pull request #219 from gautamjag7/gautamjag7-patch-11
Browse files Browse the repository at this point in the history
solved GFG_POTD_28-10-2024 Remove duplicates in array
  • Loading branch information
Gyanthakur authored Oct 29, 2024
2 parents 6996d91 + 3278e80 commit 0e74a15
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions october_2024/GFG_POTD_28-10-24_Remove_duplicates_in_array.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class Solution {
public:
vector<int> removeDuplicate(vector<int>& arr) {
vector<int>ans;
unordered_set<int>st;
for(int &it:arr){
if(st.find(it)==st.end()){
ans.push_back(it);
st.insert(it);
}
}
return ans;
}
};

0 comments on commit 0e74a15

Please sign in to comment.