Skip to content

Instantly share code, notes, and snippets.

@mad4j
Created July 26, 2015 17:28
Show Gist options
  • Save mad4j/9709d860f04a42153e95 to your computer and use it in GitHub Desktop.
Save mad4j/9709d860f04a42153e95 to your computer and use it in GitHub Desktop.
Java Sudoku Solver (codegolf edition)
class S{public static void main(String...a){int i=a[0].indexOf(48),j;char
k=48,c[]=a[0].toCharArray();if(i<0)System.out.print(c);else
for(;++k<58;){for(j=81;j-->0&&((j-i)%9*(j/9^i/9)*(j/27^i/27|j%9/3^i%9/3)
|c[j]^k)!=0;);c[i]=k;if(j<0)main("".valueOf(c));}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment