mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-07 09:58:03 +00:00
Polish permutation challenge and solution
This commit is contained in:
@@ -40,6 +40,10 @@
|
||||
"* Is whitespace important?\n",
|
||||
" * Yes\n",
|
||||
"* Is this case sensitive? 'Nib', 'bin' is not a match?\n",
|
||||
" * Yes\n",
|
||||
"* Can we use additional data structures?\n",
|
||||
" * Yes\n",
|
||||
"* Can we assume this fits in memory?\n",
|
||||
" * Yes"
|
||||
]
|
||||
},
|
||||
@@ -49,6 +53,7 @@
|
||||
"source": [
|
||||
"## Test Cases\n",
|
||||
"\n",
|
||||
"* One or more None inputs -> False\n",
|
||||
"* One or more empty strings -> False\n",
|
||||
"* 'Nib', 'bin' -> False\n",
|
||||
"* 'act', 'cat' -> True\n",
|
||||
@@ -115,6 +120,7 @@
|
||||
"class TestPermutation(object):\n",
|
||||
"\n",
|
||||
" def test_permutation(self, func):\n",
|
||||
" assert_equal(func(None, 'foo'), False)\n",
|
||||
" assert_equal(func('', 'foo'), False)\n",
|
||||
" assert_equal(func('Nib', 'bin'), False)\n",
|
||||
" assert_equal(func('act', 'cat'), True)\n",
|
||||
@@ -149,21 +155,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.5.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in New Issue
Block a user