Solution 1
its very simple.
add one single line
a[0] = 0;
only one comparison
Solution 2
for (i=0;i<n;i++)
{
Sum1 += a[i];
Sum2 +=(a[i] - 1);
}
if((Sum1 - Sum2) != n)
return TRUE;
else
return FALSE;
only one comparison :)
so simple so humble :) your PC is not a magician.
Leave a comment: