Skip to content

Instantly share code, notes, and snippets.

Created April 14, 2013 10:04
Show Gist options
  • Save anonymous/5382184 to your computer and use it in GitHub Desktop.
Save anonymous/5382184 to your computer and use it in GitHub Desktop.
def decompose(n)
return [] if n == 0
return [1] if n == 1
[n + n-1 + n-1 + n-2] + decompose(n-2)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment