-
-
Notifications
You must be signed in to change notification settings - Fork 46.6k
Fix coin change #2571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix coin change #2571
Conversation
Co-authored-by: Tapajyoti Bose <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really a useful contribution?
dynamic_programming/coin_change.py
Outdated
>>> dp_count([1, 2, 3], -5) | ||
0 | ||
>>> dp_count([4, 5, 6], -4) | ||
0 | ||
>>> dp_count([2, 5, 3, 6], -10) | ||
0 | ||
>>> dp_count([4], -4) | ||
0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>>> dp_count([1, 2, 3], -5) | |
0 | |
>>> dp_count([4, 5, 6], -4) | |
0 | |
>>> dp_count([2, 5, 3, 6], -10) | |
0 | |
>>> dp_count([4], -4) | |
0 | |
>>> dp_count([1, 2, 3], -5) | |
0 |
I think 1 test case for this is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@poyea You said to add some more test cases in the previous comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean to test the < 0
line, one test case is enough. You may add some larger test cases too to demonstrate the correctness.
Can you change the title of the pull request to something like |
@poyea done the changes have a look. |
* Removed unused variable m. * Doctests are modified to match functions. * Added condition for negative values. * Fixed white-space around operator. * Fixed W293 blank line contains white-space error. * Update dynamic_programming/coin_change.py Co-authored-by: Tapajyoti Bose <[email protected]> * Fixed error in code. * Fixed whited spacing. * Fixed PEP8 error. * Added more test cases for coin change problem. * Removed extra test for negetive value. Co-authored-by: Tapajyoti Bose <[email protected]>
* Removed unused variable m. * Doctests are modified to match functions. * Added condition for negative values. * Fixed white-space around operator. * Fixed W293 blank line contains white-space error. * Update dynamic_programming/coin_change.py Co-authored-by: Tapajyoti Bose <[email protected]> * Fixed error in code. * Fixed whited spacing. * Fixed PEP8 error. * Added more test cases for coin change problem. * Removed extra test for negetive value. Co-authored-by: Tapajyoti Bose <[email protected]>
* Removed unused variable m. * Doctests are modified to match functions. * Added condition for negative values. * Fixed white-space around operator. * Fixed W293 blank line contains white-space error. * Update dynamic_programming/coin_change.py Co-authored-by: Tapajyoti Bose <[email protected]> * Fixed error in code. * Fixed whited spacing. * Fixed PEP8 error. * Added more test cases for coin change problem. * Removed extra test for negetive value. Co-authored-by: Tapajyoti Bose <[email protected]>
* Removed unused variable m. * Doctests are modified to match functions. * Added condition for negative values. * Fixed white-space around operator. * Fixed W293 blank line contains white-space error. * Update dynamic_programming/coin_change.py Co-authored-by: Tapajyoti Bose <[email protected]> * Fixed error in code. * Fixed whited spacing. * Fixed PEP8 error. * Added more test cases for coin change problem. * Removed extra test for negetive value. Co-authored-by: Tapajyoti Bose <[email protected]>
Describe your change:
Removed unused variable and modified code for coin_chainge algo.
Checklist:
Fixes: #{$ISSUE_NO}
.