1)get the numbers
2)Sort the numbers
3)traverse from first number
4)if (a[i]==a[i+1]-1 )
{
count++;
sum+=(a[i]+a[i+1])
i++;
}
5)if (sum>max)
{
end=count;
max=sum;
}
6)print down to "count" no of elements from a[end]
will this algorithm wok?correct me if i am wrong.....
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.