mirror of
https://github.com/donnemartin/interactive-coding-challenges.git
synced 2024-03-22 13:11:13 +08:00
Renamed coinchange to coin_change.
This commit is contained in:
parent
9ed7c05318
commit
f74d40926c
|
@ -232,7 +232,7 @@ Challenges, solutions, and unit tests are presented in the form of **IPython/Jup
|
|||
|--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| Implement fibonacci recursively, dynamically, and iteratively | [Challenge](http://nbviewer.ipython.org/github/donnemartin/interactive-coding-challenges/blob/master/recursion_dynamic/fibonacci/fibonacci_challenge.ipynb)│[Solution](http://nbviewer.ipython.org/github/donnemartin/interactive-coding-challenges/blob/master/recursion_dynamic/fibonacci/fibonacci_solution.ipynb) |
|
||||
| Implement the Towers of Hanoi with 3 towers and N disks | [Challenge](http://nbviewer.ipython.org/github/donnemartin/interactive-coding-challenges/blob/master/recursion_dynamic/hanoi/hanoi_challenge.ipynb)│[Solution](http://nbviewer.ipython.org/github/donnemartin/interactive-coding-challenges/blob/master/recursion_dynamic/hanoi/hanoi_solution.ipynb) |
|
||||
| Find the number of ways to represent n cents given an array of coins | [Challenge](http://nbviewer.ipython.org/github/donnemartin/interactive-coding-challenges/blob/master/recursion_dynamic/coinchange_ways/coinchange_ways_challenge.ipynb)│[Solution](http://nbviewer.ipython.org/github/donnemartin/interactive-coding-challenges/blob/master/recursion_dynamic/coinchange_ways/coinchange_ways_solution.ipynb) |
|
||||
| Find the number of ways to represent n cents given an array of coins | [Challenge](http://nbviewer.ipython.org/github/donnemartin/interactive-coding-challenges/blob/master/recursion_dynamic/coin_change_ways/coin_change_ways_challenge.ipynb)│[Solution](http://nbviewer.ipython.org/github/donnemartin/interactive-coding-challenges/blob/master/recursion_dynamic/coin_change_ways/coin_change_ways_solution.ipynb) |
|
||||
| Implement factorial recursively, dynamically, and iteratively | [Contribute](https://github.com/donnemartin/interactive-coding-challenges/blob/master/CONTRIBUTING.md)│[Contribute](https://github.com/donnemartin/interactive-coding-challenges/blob/master/CONTRIBUTING.md) |
|
||||
| Perform a binary search on a sorted array of integers | [Contribute](https://github.com/donnemartin/interactive-coding-challenges/blob/master/CONTRIBUTING.md)│[Contribute](https://github.com/donnemartin/interactive-coding-challenges/blob/master/CONTRIBUTING.md) |
|
||||
| Print all subsets of a set | [Contribute](https://github.com/donnemartin/interactive-coding-challenges/blob/master/CONTRIBUTING.md)│[Contribute](https://github.com/donnemartin/interactive-coding-challenges/blob/master/CONTRIBUTING.md) |
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
"source": [
|
||||
"## Algorithm\n",
|
||||
"\n",
|
||||
"Refer to the [Solution Notebook](http://nbviewer.ipython.org/github/donnemartin/interactive-coding-challenges/blob/master/recursion_dynamic/coinchange_ways/coinchange_ways_solution.ipynb). If you are stuck and need a hint, the solution notebook's algorithm discussion might be a good place to start."
|
||||
"Refer to the [Solution Notebook](http://nbviewer.ipython.org/github/donnemartin/interactive-coding-challenges/blob/master/recursion_dynamic/coin_change_ways/coin_change_ways_solution.ipynb). If you are stuck and need a hint, the solution notebook's algorithm discussion might be a good place to start."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -108,22 +108,22 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"# %load test_coinchange_ways.py\n",
|
||||
"# %load test_coin_change_ways.py\n",
|
||||
"from nose.tools import assert_equal\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class Challenge(object):\n",
|
||||
"\n",
|
||||
" def test_coinchange_ways(self,solution):\n",
|
||||
" def test_coin_change_ways(self,solution):\n",
|
||||
" assert_equal(solution(0, [1, 2]), 0)\n",
|
||||
" assert_equal(solution(100, [1, 2, 3]), 884)\n",
|
||||
" assert_equal(solution(1000, range(1, 101)), 15658181104580771094597751280645)\n",
|
||||
" print('Success: test_coinchange_ways')\n",
|
||||
" print('Success: test_coin_change_ways')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def main():\n",
|
||||
" test = Challenge()\n",
|
||||
" test.test_coinchange_ways(change_ways)\n",
|
||||
" test.test_coin_change_ways(change_ways)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"if __name__ == '__main__':\n",
|
||||
|
@ -136,7 +136,7 @@
|
|||
"source": [
|
||||
"## Solution Notebook\n",
|
||||
"\n",
|
||||
"Review the [Solution Notebook](http://nbviewer.ipython.org/github/donnemartin/interactive-coding-challenges/blob/master/recursion_dynamic/coinchange_ways/coinchange_ways_solution.ipynb) for a discussion on algorithms and code solutions."
|
||||
"Review the [Solution Notebook](http://nbviewer.ipython.org/github/donnemartin/interactive-coding-challenges/blob/master/recursion_dynamic/coin_change_ways/coin_change_ways_solution.ipynb) for a discussion on algorithms and code solutions."
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
|
@ -100,27 +100,27 @@
|
|||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Overwriting test_coinchange_ways.py\n"
|
||||
"Overwriting test_coin_change_ways.py\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"%%writefile test_coinchange_ways.py\n",
|
||||
"%%writefile test_coin_change_ways.py\n",
|
||||
"from nose.tools import assert_equal\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class Challenge(object):\n",
|
||||
"\n",
|
||||
" def test_coinchange_ways(self,solution):\n",
|
||||
" def test_coin_change_ways(self,solution):\n",
|
||||
" assert_equal(solution(0, [1, 2]), 0)\n",
|
||||
" assert_equal(solution(100, [1, 2, 3]), 884)\n",
|
||||
" assert_equal(solution(1000, range(1, 101)), 15658181104580771094597751280645)\n",
|
||||
" print('Success: test_coinchange_ways')\n",
|
||||
" print('Success: test_coin_change_ways')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def main():\n",
|
||||
" test = Challenge()\n",
|
||||
" test.test_coinchange_ways(change_ways)\n",
|
||||
" test.test_coin_change_ways(change_ways)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"if __name__ == '__main__':\n",
|
||||
|
@ -138,12 +138,12 @@
|
|||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Success: test_coinchange_ways\n"
|
||||
"Success: test_coin_change_ways\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"%run -i test_coinchange_ways.py"
|
||||
"%run -i test_coin_change_ways.py"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -3,16 +3,16 @@ from nose.tools import assert_equal
|
|||
|
||||
class Challenge(object):
|
||||
|
||||
def test_coinchange_ways(self,solution):
|
||||
def test_coin_change_ways(self,solution):
|
||||
assert_equal(solution(0, [1, 2]), 0)
|
||||
assert_equal(solution(100, [1, 2, 3]), 884)
|
||||
assert_equal(solution(1000, range(1, 101)), 15658181104580771094597751280645)
|
||||
print('Success: test_coinchange_ways')
|
||||
print('Success: test_coin_change_ways')
|
||||
|
||||
|
||||
def main():
|
||||
test = Challenge()
|
||||
test.test_coinchange_ways(change_ways)
|
||||
test.test_coin_change_ways(change_ways)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue
Block a user