mirror of
https://github.com/donnemartin/interactive-coding-challenges.git
synced 2024-03-22 13:11:13 +08:00
Update compress challenge based on #44.
This commit is contained in:
parent
4953e6c114
commit
2084bbf5c9
|
@ -18,7 +18,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"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",
|
||||
"* [Constraints](#Constraints)\n",
|
||||
"* [Test Cases](#Test-Cases)\n",
|
||||
|
@ -52,7 +52,7 @@
|
|||
"* None -> None\n",
|
||||
"* '' -> ''\n",
|
||||
"* 'AABBCC' -> 'AABBCC'\n",
|
||||
"* 'AAABCCDDDD' -> 'A3B1C2D4'"
|
||||
"* 'AAABCCDDDD' -> 'A3BC2D4'"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -118,7 +118,7 @@
|
|||
" assert_equal(func(None), None)\n",
|
||||
" assert_equal(func(''), '')\n",
|
||||
" assert_equal(func('AABBCC'), 'AABBCC')\n",
|
||||
" assert_equal(func('AAABCCDDDD'), 'A3B1C2D4')\n",
|
||||
" assert_equal(func('AAABCCDDDD'), 'A3BC2D4')\n",
|
||||
" print('Success: test_compress')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
|
@ -143,21 +143,21 @@
|
|||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 2",
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python2"
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 2
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.10"
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.4.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
Loading…
Reference in New Issue
Block a user