no need to store in array
the function can look like this
int fun(int n)
{
int i=0,count=0;
boolean set=false;
while(i<sizeof(n)*8)
{
if(n^1==1)
{
if(set==false)
{
count++;
set=true;
}
}
else
set=false;
n=n>>1;
}
On Dec 21, 6:07 pm, shubham singh <[email protected]>
wrote:
> u can see topcoder and codechef tutorials may help
--
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.