Last active
December 13, 2015 19:09
-
-
Save irachex/4960941 to your computer and use it in GitHub Desktop.
Revisions
-
irachex revised this gist
Feb 15, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,5 +9,5 @@ def traverse(dep, i, size): traverse(0, 0, 1) for i in range(8): print i, cnt[i] -
irachex created this gist
Feb 15, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ cnt = {} MAX_DEP = 10 def traverse(dep, i, size): cnt[i] = cnt.get(i, 0) + 1 if dep >= MAX_DEP: return for j in range(size): traverse(dep + 1, i + j + 1, size + 1 - j) traverse(0, 0, 1) for i in range(10): print i, cnt[i]