      "collapsed": false
     },
     "outputs": [],
     "source": [
      "def calc_utopian_tree_height(cycles):\n",
      "    height = 1\n",
      "    if cycles == 0:\n",
      "        return height\n",
      "    for i in range(1, cycles+1):\n",
      "        if i % 2 == 1:\n",
      "            height *= 2\n",
      "        else:\n",
      "            height += 1\n",
      "    return height"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
 
</s> remove     "def calc_utopian_tree_height(cycles):\n",
    "    # TODO: Implement me\n",
    "    pass"
 </s> add     "class Solution(object):\n",
    "\n",
    "    def calc_utopian_tree_height(self, cycles):\n",
    "        # TODO: Implement me\n",
    "        pass" </s> remove     "        assert_equal(calc_utopian_tree_height(0), 1)\n",
    "        assert_equal(calc_utopian_tree_height(1), 2)\n",
    "        assert_equal(calc_utopian_tree_height(4), 7)\n",
 </s> add     "        solution = Solution()\n",
    "        assert_equal(solution.calc_utopian_tree_height(0), 1)\n",
    "        assert_equal(solution.calc_utopian_tree_height(1), 2)\n",
    "        assert_equal(solution.calc_utopian_tree_height(4), 7)\n", </s> remove     "        assert_equal(calc_utopian_tree_height(0), 1)\n",
    "        assert_equal(calc_utopian_tree_height(1), 2)\n",
    "        assert_equal(calc_utopian_tree_height(4), 7)\n",
 </s> add     "        solution = Solution()\n",
    "        assert_equal(solution.calc_utopian_tree_height(0), 1)\n",
    "        assert_equal(solution.calc_utopian_tree_height(1), 2)\n",
    "        assert_equal(solution.calc_utopian_tree_height(4), 7)\n", </s> remove     "version": 2
 </s> add     "version": 3 </s> remove     "version": 2
 </s> add     "version": 3
    "class Solution(object):\n",
    "\n",
    "    def calc_utopian_tree_height(self, cycles):\n",
    "        height = 1\n",
    "        if cycles == 0:\n",
    "            return height\n",
    "        for i in range(1, cycles+1):\n",
    "            if i % 2 == 1:\n",
    "                height *= 2\n",
    "            else:\n",
    "                height += 1\n",
    "        return height"
      "collapsed": false
     },
     "outputs": [],
     "source": [
    "class Solution(object):\n",
    "\n",
    "    def calc_utopian_tree_height(self, cycles):\n",
    "        height = 1\n",
    "        if cycles == 0:\n",
    "            return height\n",
    "        for i in range(1, cycles+1):\n",
    "            if i % 2 == 1:\n",
    "                height *= 2\n",
    "            else:\n",
    "                height += 1\n",
    "        return height"
    "class Solution(object):\n",
    "\n",
    "    def calc_utopian_tree_height(self, cycles):\n",
    "        height = 1\n",
    "        if cycles == 0:\n",
    "            return height\n",
    "        for i in range(1, cycles+1):\n",
    "            if i % 2 == 1:\n",
    "                height *= 2\n",
    "            else:\n",
    "                height += 1\n",
    "        return height"
    "class Solution(object):\n",
    "\n",
    "    def calc_utopian_tree_height(self, cycles):\n",
    "        height = 1\n",
    "        if cycles == 0:\n",
    "            return height\n",
    "        for i in range(1, cycles+1):\n",
    "            if i % 2 == 1:\n",
    "                height *= 2\n",
    "            else:\n",
    "                height += 1\n",
    "        return height"
    "class Solution(object):\n",
    "\n",
    "    def calc_utopian_tree_height(self, cycles):\n",
    "        height = 1\n",
    "        if cycles == 0:\n",
    "            return height\n",
    "        for i in range(1, cycles+1):\n",
    "            if i % 2 == 1:\n",
    "                height *= 2\n",
    "            else:\n",
    "                height += 1\n",
    "        return height"
    "class Solution(object):\n",
    "\n",
    "    def calc_utopian_tree_height(self, cycles):\n",
    "        height = 1\n",
    "        if cycles == 0:\n",
    "            return height\n",
    "        for i in range(1, cycles+1):\n",
    "            if i % 2 == 1:\n",
    "                height *= 2\n",
    "            else:\n",
    "                height += 1\n",
    "        return height"
    "class Solution(object):\n",
    "\n",
    "    def calc_utopian_tree_height(self, cycles):\n",
    "        height = 1\n",
    "        if cycles == 0:\n",
    "            return height\n",
    "        for i in range(1, cycles+1):\n",
    "            if i % 2 == 1:\n",
    "                height *= 2\n",
    "            else:\n",
    "                height += 1\n",
    "        return height"
    "class Solution(object):\n",
    "\n",
    "    def calc_utopian_tree_height(self, cycles):\n",
    "        height = 1\n",
    "        if cycles == 0:\n",
    "            return height\n",
    "        for i in range(1, cycles+1):\n",
    "            if i % 2 == 1:\n",
    "                height *= 2\n",
    "            else:\n",
    "                height += 1\n",
    "        return height"
    "class Solution(object):\n",
    "\n",
    "    def calc_utopian_tree_height(self, cycles):\n",
    "        height = 1\n",
    "        if cycles == 0:\n",
    "            return height\n",
    "        for i in range(1, cycles+1):\n",
    "            if i % 2 == 1:\n",
    "                height *= 2\n",
    "            else:\n",
    "                height += 1\n",
    "        return height"
    "class Solution(object):\n",
    "\n",
    "    def calc_utopian_tree_height(self, cycles):\n",
    "        height = 1\n",
    "        if cycles == 0:\n",
    "            return height\n",
    "        for i in range(1, cycles+1):\n",
    "            if i % 2 == 1:\n",
    "                height *= 2\n",
    "            else:\n",
    "                height += 1\n",
    "        return height"
    "class Solution(object):\n",
    "\n",
    "    def calc_utopian_tree_height(self, cycles):\n",
    "        height = 1\n",
    "        if cycles == 0:\n",
    "            return height\n",
    "        for i in range(1, cycles+1):\n",
    "            if i % 2 == 1:\n",
    "                height *= 2\n",
    "            else:\n",
    "                height += 1\n",
    "        return height"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
keep keep keep keep replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Move utopian tree challenge solution to a class (#144) 
online_judges/utopian_tree/utopian_tree_solution.ipynb