Skip to content

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

blueenvelope31
Copy link

No description provided.

@@ -0,0 +1,50 @@
def isSubsetSumDP(s, total):
Copy link
Owner

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.

@@ -0,0 +1,50 @@
def isSubsetSumDP(s, total):
Copy link
Owner

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.

# 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])
Copy link
Owner

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
Copy link
Owner

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.

Copy link
Owner

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants