diff --git a/Standard Template Library/Removing_Duplicate_Using_Set.cpp b/Standard Template Library/Removing_Duplicate_Using_Set.cpp new file mode 100644 index 0000000..aa423fc --- /dev/null +++ b/Standard Template Library/Removing_Duplicate_Using_Set.cpp @@ -0,0 +1,12 @@ +//https://practice.geeksforgeeks.org/problems/remove-duplicate-elements-from-sorted-array/1/?track=ppc-arrays&batchId=221 + +//Given a sorted array A of size N. The function remove_duplicate takes two arguments . The first argument is the sorted array A[ ] and the second argument is 'N' the size of the array and returns the size of the new converted array A[ ] with no duplicate element. + +//solution +int remove_duplicate(int A[],int N) +{ + set v(A, A+N); + copy(v.begin(), v.end(), A); + +return v.size(); +} \ No newline at end of file