Update compress challenge based on #44.

This commit is contained in:
Donne Martin 2016-02-09 07:00:41 -05:00
parent 4953e6c114
commit 2084bbf5c9

View File

@ -18,7 +18,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"## Problem: Compress a string such that 'AAABCCDDDD' becomes 'A3B1C2D4'. Only compress the string if it saves space.\n", "## Problem: Compress a string such that 'AAABCCDDDD' becomes 'A3BC2D4'. Only compress the string if it saves space.\n",
"\n", "\n",
"* [Constraints](#Constraints)\n", "* [Constraints](#Constraints)\n",
"* [Test Cases](#Test-Cases)\n", "* [Test Cases](#Test-Cases)\n",
@ -52,7 +52,7 @@
"* None -> None\n", "* None -> None\n",
"* '' -> ''\n", "* '' -> ''\n",
"* 'AABBCC' -> 'AABBCC'\n", "* 'AABBCC' -> 'AABBCC'\n",
"* 'AAABCCDDDD' -> 'A3B1C2D4'" "* 'AAABCCDDDD' -> 'A3BC2D4'"
] ]
}, },
{ {
@ -118,7 +118,7 @@
" assert_equal(func(None), None)\n", " assert_equal(func(None), None)\n",
" assert_equal(func(''), '')\n", " assert_equal(func(''), '')\n",
" assert_equal(func('AABBCC'), 'AABBCC')\n", " assert_equal(func('AABBCC'), 'AABBCC')\n",
" assert_equal(func('AAABCCDDDD'), 'A3B1C2D4')\n", " assert_equal(func('AAABCCDDDD'), 'A3BC2D4')\n",
" print('Success: test_compress')\n", " print('Success: test_compress')\n",
"\n", "\n",
"\n", "\n",
@ -143,21 +143,21 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 2", "display_name": "Python 3",
"language": "python", "language": "python",
"name": "python2" "name": "python3"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
"name": "ipython", "name": "ipython",
"version": 2 "version": 3
}, },
"file_extension": ".py", "file_extension": ".py",
"mimetype": "text/x-python", "mimetype": "text/x-python",
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython2", "pygments_lexer": "ipython3",
"version": "2.7.10" "version": "3.4.3"
} }
}, },
"nbformat": 4, "nbformat": 4,