Binary Search: Difference between revisions
Jump to navigation
Jump to search
imported>Kmk21 Created page with "=Java= <syntaxhighlight line lang="java"> int mask=1,ans=0; while(mask<max)mask<<=1; while(mask>0) { if(→test condition: )ans|=mask; mask>>=1; } </syntaxhighlight>" |
(No difference)
|
Revision as of 02:52, 16 February 2015
Java
int mask=1,ans=0;
while(mask<max)mask<<=1;
while(mask>0) {
if(/*test condition*/)ans|=mask;
mask>>=1;
}