class Solution {
public:
int duplicateInArray(vector[HTML_REMOVED]& nums) {
int res[1000] = {0};
for(vector[HTML_REMOVED]::iterator it = nums.begin(); it < nums.end(); it++)
{
if(it > nums.size() - 1 || it < 0)
{
return -1;
}
res[*it]++;
}
for(int i = 0; i < 1000; i++)
{
if(res[i] > 1)
return i;
}
return -1;
}
};