Vaibhavs
BAN USER
Comments (3)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
Not one of the best.
Suggestions appreciated.
int i=0; sum=0; count=0;
while( a[i] == a[i+1] && (i+1) < n )
{
sum = sum + a[i];
i++; count++;
}
sum = sum + a[i]; count ++;
if( sum % 2 != 0 )
{
cout<< a[i]; break;
}
else if ( sum % 2 ==0 && count % 2 != 0 )
{
cout<< a[i]; break;
}
else
{
i++; count = 0; sum = 0;
}
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
If the input is "ad" and "bc"; it fails.
- Vaibhavs March 07, 2011