I came across a post How to find a duplicate element in an array of shuffled consecutive integers? but later realized that this fails for many input.
For ex:
a
//There i have created the program to find out the duplicate element in array. Please edit if there are required some changes.
int main()
{
int arr[] = {601,602,603,604,605,605,606,607};
//int arr[] = {601,601,604,602,605,606,607};
int n= sizeof(arr)/sizeof(arr[0]);
for (int i = 0; i < n; i++)
{
for (int j = i+1; j < n; j++)
{
int res = arr[i] ^ arr[j];
if (res == 0)
{
std::cout<< "Repeated Element in array = "<
//OR You can use HashTable and Hash Function when you enter the same
value into the hash table that time you can make count if its greater than
one value at particular index of HashTable then you can say that there are repeated value in the array.