|
Re: duplicate numbers in arrays
I made a boo-boo:
Quote:
|
Originally Posted by lectricpharaoh
if(isValueInArray(n, list, idx) { list[idx] = n; ++idx; }
|
You need to invert that condition, and I missed a parenthesis: if(!isValueInArray(n, list, idx))
{
list[idx] = n;
++idx;
}
__________________
A man's knowledge is like an expanding sphere, the surface corresponding to the boundary between the known and the unknown. As the sphere grows, so does its surface; the more a man learns, the more he realizes how much he does not know. Hence, the most ignorant man thinks he knows it all. - L. Sprague de Camp
|