Skip to main content
added 4 characters in body
Source Link
Unmitigated
  • 2.8k
  • 1
  • 5
  • 14

Java, 257 246 210 200 195 190 188 186 181 bytes

a->{int r=9,i=512,j,e,s,k,x,z,b,c=9;for(;i-->0;r=e!=0|r<c?r:c)for(j=s=e=0;j<3;s=j++<1?x:s,e|=x-s)for(k=x=c=0;k<9;z=b>0?7:a[k],x+=k/3==j?z:0,x+=k++%3==j?30*z:0)c+=b=i>>k&1;return r;}
a->{int r=9,i=512,j,e,s,k,x,z,b,c=9;for(;i-->0;r=e!=0|r<c?r:c)for(j=s=e=0;j<3;s=j++<1?x:s,e|=x-s)for(k=x=c=0;k<9;z=b>0?7:a[k],x+=k/3==j?z:0,x+=k++%3==j?30*z:0)c+=b=i>>k&1;return r;}

Saved 11 bytes thanks to ceilingcat.

Saved 46 bytes thanks to Olivier Grégoire.

Saved 19 bytes thanks to Donat.

Takes a flat array as input. This method tries all 512 (29) possibilities by using the binary representations of the integers from 0 to 511. On each iteration, it sets the values at all indexes where i has a set bit to 7. Then, it checks if the current array is valid, in which case the answer is updated.

Try it online!

Java, 257 246 210 200 195 190 188 186 181 bytes

a->{int r=9,i=512,j,e,s,k,x,z,b,c=9;for(;i-->0;r=e!=0|r<c?r:c)for(j=s=e=0;j<3;s=j++<1?x:s,e|=x-s)for(k=x=c=0;k<9;z=b>0?7:a[k],x+=k/3==j?z:0,x+=k++%3==j?30*z:0)c+=b=i>>k&1;return r;}

Saved 11 bytes thanks to ceilingcat.

Saved 46 bytes thanks to Olivier Grégoire.

Saved 19 bytes thanks to Donat.

Takes a flat array as input. This method tries all 512 (29) possibilities by using the binary representations of the integers from 0 to 511. On each iteration, it sets the values at all indexes where i has a set bit to 7. Then, it checks if the current array is valid, in which case the answer is updated.

Try it online!

Java, 257 246 210 200 195 190 188 186 181 bytes

a->{int r=9,i=512,j,e,s,k,x,z,b,c=9;for(;i-->0;r=e!=0|r<c?r:c)for(j=s=e=0;j<3;s=j++<1?x:s,e|=x-s)for(k=x=c=0;k<9;z=b>0?7:a[k],x+=k/3==j?z:0,x+=k++%3==j?30*z:0)c+=b=i>>k&1;return r;}

Saved 11 bytes thanks to ceilingcat.

Saved 46 bytes thanks to Olivier Grégoire.

Saved 19 bytes thanks to Donat.

Takes a flat array as input. This method tries all 512 (29) possibilities by using the binary representations of the integers from 0 to 511. On each iteration, it sets the values at all indexes where i has a set bit to 7. Then, it checks if the current array is valid, in which case the answer is updated.

Try it online!

added 2 characters in body
Source Link
Unmitigated
  • 2.8k
  • 1
  • 5
  • 14

Java, 257 246 210 200 195 190 188 186186 181 bytes

a->{int r=9,i=512,j,e,s,k,x,y,z,b,c=9;for(;i-->0;r=e!=0|r<c?r:c)for(j=s=e=0;j<3;s=j++<1?x:s,e|=x-s|y-s)for(k=x=y=c=0;k<9;z=b>0k=x=c=0;k<9;z=b>0?7:a[k],x+=k/3==j?z:0,y+=k++%3==jx+=k++%3==j?z30*z:0)c+=b=i>>k&1;return r;}

Saved 11 bytes thanks to ceilingcat.

Saved 46 bytes thanks to Olivier Grégoire.

Saved 1419 bytes thanks to Donat.

Takes a flat array as input. This method tries all 512 (29) possibilities by using the binary representations of the integers from 0 to 511. On each iteration, it sets the values at all indexes where i has a set bit to 7. Then, it checks if the current array is valid, in which case the answer is updated.

Try it online!Try it online!

Java, 257 246 210 200 195 190 188 186 bytes

a->{int r=9,i=512,j,e,s,k,x,y,z,b,c=9;for(;i-->0;r=e!=0|r<c?r:c)for(j=s=e=0;j<3;s=j++<1?x:s,e|=x-s|y-s)for(k=x=y=c=0;k<9;z=b>0?7:a[k],x+=k/3==j?z:0,y+=k++%3==j?z:0)c+=b=i>>k&1;return r;}

Saved 11 bytes thanks to ceilingcat.

Saved 46 bytes thanks to Olivier Grégoire.

Saved 14 bytes thanks to Donat.

Takes a flat array as input. This method tries all 512 (29) possibilities by using the binary representations of the integers from 0 to 511. On each iteration, it sets the values at all indexes where i has a set bit to 7. Then, it checks if the current array is valid, in which case the answer is updated.

Try it online!

Java, 257 246 210 200 195 190 188 186 181 bytes

a->{int r=9,i=512,j,e,s,k,x,z,b,c=9;for(;i-->0;r=e!=0|r<c?r:c)for(j=s=e=0;j<3;s=j++<1?x:s,e|=x-s)for(k=x=c=0;k<9;z=b>0?7:a[k],x+=k/3==j?z:0,x+=k++%3==j?30*z:0)c+=b=i>>k&1;return r;}

Saved 11 bytes thanks to ceilingcat.

Saved 46 bytes thanks to Olivier Grégoire.

Saved 19 bytes thanks to Donat.

Takes a flat array as input. This method tries all 512 (29) possibilities by using the binary representations of the integers from 0 to 511. On each iteration, it sets the values at all indexes where i has a set bit to 7. Then, it checks if the current array is valid, in which case the answer is updated.

Try it online!

added 5 characters in body
Source Link
Unmitigated
  • 2.8k
  • 1
  • 5
  • 14

Java, 257 246 210 200 195 190 188188 186 bytes

a->{int r=9,i=512,j,e,s,k,x,y,z,b,c=9;for(;i-->0;r=e!=0|r<c?r:c)for(j=s=e=0;j<3;s=j++<1?x:s,e|=x-s|y-s)for(k=x=y=c=0;k<9;x+=kk=x=y=c=0;k<9;z=b>0?7:a[k],x+=k/3==j?z:0,y+=k++%3==j?z:0){c+=b=i>>k&1;z=b>0?7:a[k];}returnc+=b=i>>k&1;return r;}

Saved 11 bytes thanks to ceilingcat.

Saved 46 bytes thanks to Olivier Grégoire.

Saved 1214 bytes thanks to Donat.

Takes a flat array as input. This method tries all 512 (29) possibilities by using the binary representations of the integers from 0 to 511. On each iteration, it sets the values at all indexes where i has a set bit to 7. Then, it checks if the current array is valid, in which case the answer is updated.

Try it online!Try it online!

Java, 257 246 210 200 195 190 188 bytes

a->{int r=9,i=512,j,e,s,k,x,y,z,b,c=9;for(;i-->0;r=e!=0|r<c?r:c)for(j=s=e=0;j<3;s=j++<1?x:s,e|=x-s|y-s)for(k=x=y=c=0;k<9;x+=k/3==j?z:0,y+=k++%3==j?z:0){c+=b=i>>k&1;z=b>0?7:a[k];}return r;}

Saved 11 bytes thanks to ceilingcat.

Saved 46 bytes thanks to Olivier Grégoire.

Saved 12 bytes thanks to Donat.

Takes a flat array as input. This method tries all 512 (29) possibilities by using the binary representations of the integers from 0 to 511. On each iteration, it sets the values at all indexes where i has a set bit to 7. Then, it checks if the current array is valid, in which case the answer is updated.

Try it online!

Java, 257 246 210 200 195 190 188 186 bytes

a->{int r=9,i=512,j,e,s,k,x,y,z,b,c=9;for(;i-->0;r=e!=0|r<c?r:c)for(j=s=e=0;j<3;s=j++<1?x:s,e|=x-s|y-s)for(k=x=y=c=0;k<9;z=b>0?7:a[k],x+=k/3==j?z:0,y+=k++%3==j?z:0)c+=b=i>>k&1;return r;}

Saved 11 bytes thanks to ceilingcat.

Saved 46 bytes thanks to Olivier Grégoire.

Saved 14 bytes thanks to Donat.

Takes a flat array as input. This method tries all 512 (29) possibilities by using the binary representations of the integers from 0 to 511. On each iteration, it sets the values at all indexes where i has a set bit to 7. Then, it checks if the current array is valid, in which case the answer is updated.

Try it online!

added 9 characters in body
Source Link
Unmitigated
  • 2.8k
  • 1
  • 5
  • 14
Loading
added 2 characters in body
Source Link
Unmitigated
  • 2.8k
  • 1
  • 5
  • 14
Loading
added 85 characters in body
Source Link
Unmitigated
  • 2.8k
  • 1
  • 5
  • 14
Loading
deleted 5 characters in body
Source Link
Unmitigated
  • 2.8k
  • 1
  • 5
  • 14
Loading
added 150 characters in body
Source Link
Unmitigated
  • 2.8k
  • 1
  • 5
  • 14
Loading
deleted 1 character in body
Source Link
Unmitigated
  • 2.8k
  • 1
  • 5
  • 14
Loading
Source Link
Unmitigated
  • 2.8k
  • 1
  • 5
  • 14
Loading