diff --git a/common_ds_algo_problems/Find Duplicate b/common_ds_algo_problems/Find Duplicate new file mode 100644 index 0000000..d15b27e --- /dev/null +++ b/common_ds_algo_problems/Find Duplicate @@ -0,0 +1,36 @@ +#include +using namespace std; +int duplicateNumber(int *arr, int size) +{ + int i; + int newsum=((size-2)*(size-1))/2; //n(n+1)/2 sum of n natural no. + int sum=0; + for(i=0;i> t; + + while (t--) + { + int size; + cin >> size; + int *input = new int[size]; + + for (int i = 0; i < size; i++) + { + cin >> input[i]; + } + + cout << duplicateNumber(input, size) << endl; + } + + return 0; +}