Hello Madhumitha,
About the problem : `Find the duplicate in an array of N integers`
If we know that numbers are less than n+1 we can use `count sort` which sorts array with complexity of O(n). We make another array with the same size and we set each elements `null`(or anything that help us to understand this element is not filled yet). Now we can iterate over the original array and we can put every number in it's real order in new array:
for (element in originalArray)
if(sortedArray[element] == null)
sortedArray[element] = element;
else
return element // this element is duplicated