if(t&&!(t&(t-1)) return true;

reason:
any power of two will be of form 00100 that is 0 at only one position.If you
subtract 1 from it that will make it of the form 000011 that is ones at all
positions to the right except the position where there is 1 in the original
number.If you take and now you will always get 0;

On Sat, Jul 30, 2011 at 11:49 AM, tech rascal <[email protected]>wrote:

>
>  --
> 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.
>



-- 
Saurabh Singh
B.Tech (Computer Science)
MNNIT ALLAHABAD

-- 
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.

Reply via email to