Hello Ashish,

I would do something like here -  
http://www.evaluzio.net/library/verify-1-0-bits-in-num.htm

Basically you just count the number of 01 and 10 binary sequences using  (n 
& 3 == 1) or (n & 3 == 2)

Regards,
Ilya

On Tuesday, 3 April 2012 17:00:36 UTC-7, ashgoel wrote:
>
> verify that the bits of a number are in format 1s followed by 0s followed 
> by 1s like 1110001 is valid but 100100100 is not
>
> Best Regards
> Ashish Goel
> "Think positive and find fuel in failure"
> +919985813081
> +919966006652
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/DFNF8rFO62UJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to