From 1d2317e0b42ea90923763fb44492cae275a67686 Mon Sep 17 00:00:00 2001 From: tanmayranaware Date: Thu, 8 Oct 2020 00:45:18 +0530 Subject: [PATCH] working on string and having bug --- RemovetheDuplicates.cpp | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 RemovetheDuplicates.cpp diff --git a/RemovetheDuplicates.cpp b/RemovetheDuplicates.cpp new file mode 100644 index 0000000..4d507c1 --- /dev/null +++ b/RemovetheDuplicates.cpp @@ -0,0 +1,54 @@ +// C++ program for removing duplicates +#include +using namespace std; + +// Function to remove duplicate elements +// This function returns new size of modifi +int removeDuplicates(int arr[], int n) +{ + // Return, if array is empty + // or contains a single element + if (n==0 || n==1) + return n; + + int temp[n]; + + // Start traversing elements + int j = 0; + for (int i=0; i