Skip to content

Instantly share code, notes, and snippets.

@erukiti
Created May 27, 2015 17:13
Show Gist options
  • Save erukiti/a3994b5d706d645a88e2 to your computer and use it in GitHub Desktop.
Save erukiti/a3994b5d706d645a88e2 to your computer and use it in GitHub Desktop.
#! /usr/bin/env coffee
solver = (n, s)->
if n == 10
console.log(s) if eval(s) == 100
return
solver(n + 1, s + '+' + n)
solver(n + 1, s + '-' + n)
solver(n + 1, s + n)
solver(2, '1')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment