mirror of
https://github.com/donnemartin/interactive-coding-challenges.git
synced 2024-03-22 13:11:13 +08:00
Polish set of stacks challenge
This commit is contained in:
parent
ba14cb0417
commit
2b92f51a4e
|
@ -36,7 +36,7 @@
|
|||
"\n",
|
||||
"* Can we assume we already have a stack class that can be used for this problem?\n",
|
||||
" * Yes\n",
|
||||
"* If a stack becomes full, we should automatically create one?\n",
|
||||
"* If a stack becomes full, should automatically create one?\n",
|
||||
" * Yes\n",
|
||||
"* If a stack becomes empty, should we delete it?\n",
|
||||
" * Yes"
|
||||
|
@ -51,7 +51,7 @@
|
|||
"* Push and pop on an empty stack\n",
|
||||
"* Push and pop on a non-empty stack\n",
|
||||
"* Push on a capacity stack to create a new one\n",
|
||||
"* Pop on a one element stack to destroy it"
|
||||
"* Pop on a stack to destroy it"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -151,8 +151,7 @@
|
|||
"\n",
|
||||
" def test_set_of_stacks(self):\n",
|
||||
" print('Test: Push on an empty stack')\n",
|
||||
" capacity = 2\n",
|
||||
" stacks = SetOfStacks(capacity)\n",
|
||||
" stacks = SetOfStacks(capacity=2)\n",
|
||||
" stacks.push(3)\n",
|
||||
"\n",
|
||||
" print('Test: Push on a non-empty stack')\n",
|
||||
|
@ -161,7 +160,7 @@
|
|||
" print('Test: Push on a capacity stack to create a new one')\n",
|
||||
" stacks.push('a')\n",
|
||||
"\n",
|
||||
" print('Test: Pop on a one element stack to destroy it')\n",
|
||||
" print('Test: Pop on a stack to destroy it')\n",
|
||||
" assert_equal(stacks.pop(), 'a')\n",
|
||||
"\n",
|
||||
" print('Test: Pop general case')\n",
|
||||
|
@ -195,21 +194,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