-
Notifications
You must be signed in to change notification settings - Fork 8
Issue #3 Subset Sum #6
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
base: master
Are you sure you want to change the base?
Conversation
dp/is_subset_sum.py
Outdated
@@ -0,0 +1,50 @@ | |||
def isSubsetSumDP(s, total): |
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.
Could you rename it to isSubsetSum? Let's not mention the word DP in the function name.
dp/is_subset_sum.py
Outdated
@@ -0,0 +1,50 @@ | |||
def isSubsetSumDP(s, total): |
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.
Could you also add comments stating what the module is supposed to do?
Also, add doctest in the comments.
dp/is_subset_sum.py
Outdated
# else, check if total can be obtained by any of the following | ||
# (a) including the last element | ||
# (b) excluding the last element | ||
return isSubsetSumHelper(s, n-1, total) or isSubsetSumHelper(s, n-1, total-s[n-1]) |
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.
Also, add pytest test case for the same functionality. Please check the other test cases in the test directory for reference.
@@ -0,0 +1,16 @@ | |||
import unittest |
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.
Can you write the test case using pytest?
We've moved to automated test builds and use pytest for the same in travis.
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.
You can refer this for docs: https://docs.pytest.org/en/latest/
No description provided.