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 Revisions

2 of 4
added 112 characters in body
Olivier Grégoire
  • 14.5k
  • 3
  • 33
  • 56

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!

Olivier Grégoire
  • 14.5k
  • 3
  • 33
  • 56

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