Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

deleted 3 characters in body
Source Link
Olivier Grégoire
  • 14.5k
  • 3
  • 33
  • 56

Java (OpenJDK 8), 73 bytes

n->{int m=0,i=1,x;fori=1;for(;i<n>>7;m=x>m?x:;i<n>>7;i*=2)m=Math.max(m,i*=2)x=n&~n&~-i|(n>>8&-i));return m;}

Try it online! Try it online!

Java (OpenJDK 8), 73 bytes

n->{int m=0,i=1,x;for(;i<n>>7;m=x>m?x:m,i*=2)x=n&~-i|(n>>8&-i);return m;}

Try it online!

Java (OpenJDK 8), 73 bytes

n->{int m=0,i=1;for(;i<n>>7;i*=2)m=Math.max(m,n&~-i|(n>>8&-i));return m;}

Try it online!

deleted 70 characters in body
Source Link
Olivier Grégoire
  • 14.5k
  • 3
  • 33
  • 56

Java (OpenJDK 8), 10473 bytes

n->{int N=0,i=8m=0,I=1i=1,x;for(;I<n.highestOneBit(n>>7);N=x>N;i<n>>7;m=x>m?x:Nm,I<<=1i*=2)x=(Ix=n&~-1&n)|(i|(~0<<i++&n)>>8n>>8&-i);return N;m;}

Try it online! Try it online!

Java (OpenJDK 8), 104 bytes

n->{int N=0,i=8,I=1,x;for(;I<n.highestOneBit(n>>7);N=x>N?x:N,I<<=1)x=(I-1&n)|((~0<<i++&n)>>8);return N;}

Try it online!

Java (OpenJDK 8), 73 bytes

n->{int m=0,i=1,x;for(;i<n>>7;m=x>m?x:m,i*=2)x=n&~-i|(n>>8&-i);return m;}

Try it online!

added 112 characters in body
Source Link
Olivier Grégoire
  • 14.5k
  • 3
  • 33
  • 56

Java (OpenJDK 8), 106104 bytes

n->{int N=0,i=8,I=1,x;for(;I<n.highestOneBit(n>>7)-1;N=x>N;N=x>N?x:N,I<<=1)x=(I-1&n)|((~0<<i++&n)>>8);return N;}

Try it online!

Looks like I'm the only one actually playing with bits ;-)Try it online!

Java (OpenJDK 8), 106 bytes

n->{int N=0,i=8,I=1,x;for(;I<n.highestOneBit(n>>7)-1;N=x>N?x:N,I<<=1)x=(I-1&n)|((~0<<i++&n)>>8);return N;}

Try it online!

Looks like I'm the only one actually playing with bits ;-)

Java (OpenJDK 8), 104 bytes

n->{int N=0,i=8,I=1,x;for(;I<n.highestOneBit(n>>7);N=x>N?x:N,I<<=1)x=(I-1&n)|((~0<<i++&n)>>8);return N;}

Try it online!

Source Link
Olivier Grégoire
  • 14.5k
  • 3
  • 33
  • 56
Loading

AltStyle によって変換されたページ (->オリジナル) /