Tweaked utopian tree algorithm discussion, cleared challenge code section.

This commit is contained in:
Donne Martin
2015-07-06 05:45:44 -04:00
parent 3061020cc1
commit d4a2300ea0
2 changed files with 4 additions and 11 deletions

View File

@@ -68,7 +68,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {
"collapsed": false
},
@@ -78,15 +78,8 @@
"# cycles = 1, print 2: i = 1: 1 * 2\n",
"# cycles = 4, print 7: i = 1: 1 * 2, i = 2: 2 + 1, i = 3: 3 * 2, i = 4: 6 + 1\n",
"def calc_utopian_tree_height(cycles):\n",
" height = 1\n",
" if cycles == 0:\n",
" return height\n",
" for i in xrange(1, cycles+1):\n",
" if i % 2 == 1:\n",
" height *= 2\n",
" else:\n",
" height += 1\n",
" return height"
" # TODO: Implement me\n",
" pass"
]
},
{