Skip to content

Instantly share code, notes, and snippets.

@dstarh
Created November 17, 2009 18:34
Show Gist options
  • Save dstarh/237130 to your computer and use it in GitHub Desktop.
Save dstarh/237130 to your computer and use it in GitHub Desktop.
def r(a){def i=a.indexOf(48);if(i<0)print a else(('1'..'9')-(0..80).collect{j-> g={(int)it(i)==(int)it(j)};g{it/9}|g{it%9}|g{it/27}&g{it%9/3}?a[j]:'0'}).each{ r(a[0..<i]+it+a[i+1..-1])}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment