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

Commonmark migration
Source Link

#C (gcc), (削除) 91 (削除ここまで) bytes

C (gcc), (削除) 91 (削除ここまで) bytes

j;m;t;f(x){for(j=m=0;t=x>>j+8;m<t?m=t:j++)t=t<<j|x%(1<<j);return m;}

-23 bytes from Colera Su

Supports up to 2**31-1

Try it online!

Starts with the low 8 bits (j=0), then goes up, changing output if the number with bits [j,j+8) cut out is bigger than our current, and continuing until x has no bits above j+8

#C (gcc), (削除) 91 (削除ここまで) bytes

j;m;t;f(x){for(j=m=0;t=x>>j+8;m<t?m=t:j++)t=t<<j|x%(1<<j);return m;}

-23 bytes from Colera Su

Supports up to 2**31-1

Try it online!

Starts with the low 8 bits (j=0), then goes up, changing output if the number with bits [j,j+8) cut out is bigger than our current, and continuing until x has no bits above j+8

C (gcc), (削除) 91 (削除ここまで) bytes

j;m;t;f(x){for(j=m=0;t=x>>j+8;m<t?m=t:j++)t=t<<j|x%(1<<j);return m;}

-23 bytes from Colera Su

Supports up to 2**31-1

Try it online!

Starts with the low 8 bits (j=0), then goes up, changing output if the number with bits [j,j+8) cut out is bigger than our current, and continuing until x has no bits above j+8

-23 from Colera Su
Source Link
pizzapants184
  • 3.6k
  • 16
  • 18

#C (gcc), 91(削除) 91 (削除ここまで) bytes

j;m;fj;m;t;f(x){for(j=m=0;x>>j>>8;j++)m=m>(x>>(j+8)<<j|x%(1<<j))j=m=0;t=x>>j+8;m<t?mm=t:x>>(j+8j++)<<j|x%t=t<<j|x%(1<<j);return m;}

-23 bytes from Colera Su

Supports up to 2**31-1

Try it online! Try it online!

Starts with the low 8 bits (j=0), then goes up, changing output if the number with bits [j,j+8) cut out is bigger than our current, and continuing until x has no bits above j+8

#C (gcc), 91 bytes

j;m;f(x){for(j=m=0;x>>j>>8;j++)m=m>(x>>(j+8)<<j|x%(1<<j))?m:x>>(j+8)<<j|x%(1<<j);return m;}

Supports up to 2**31-1

Try it online!

Starts with the low 8 bits (j=0), then goes up, changing output if the number with bits [j,j+8) cut out is bigger than our current, and continuing until x has no bits above j+8

#C (gcc), (削除) 91 (削除ここまで) bytes

j;m;t;f(x){for(j=m=0;t=x>>j+8;m<t?m=t:j++)t=t<<j|x%(1<<j);return m;}

-23 bytes from Colera Su

Supports up to 2**31-1

Try it online!

Starts with the low 8 bits (j=0), then goes up, changing output if the number with bits [j,j+8) cut out is bigger than our current, and continuing until x has no bits above j+8

Source Link
pizzapants184
  • 3.6k
  • 16
  • 18

#C (gcc), 91 bytes

j;m;f(x){for(j=m=0;x>>j>>8;j++)m=m>(x>>(j+8)<<j|x%(1<<j))?m:x>>(j+8)<<j|x%(1<<j);return m;}

Supports up to 2**31-1

Try it online!

Starts with the low 8 bits (j=0), then goes up, changing output if the number with bits [j,j+8) cut out is bigger than our current, and continuing until x has no bits above j+8

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