vjgvnd91
BAN USER
Comments (3)
Reputation -5
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
int start_pos, len=0;
void long(int arr[], int n)
{
int count, s_p, i=0;
while(i < n)
{
count=1;
if(arr[i+1] == arr[i]+1)
{
s_p = i;
count++;
for(int j=i+2; j<n-1; j++)
{
if(arr[j] != arr[j+1])
break;
count++;
}
}
if(count > len)
{
len = count;
start_pos = s_p;
}
i = i+count;
}
}
Comment hidden because of low score. Click to expand.
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
- vjgvnd91 November 15, 2012