Skip to content
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

Add a similar and maybe more understandable algorithm of generate_parenthesis #381

Closed
wants to merge 2 commits into from
Closed

Conversation

ghost
Copy link

@ghost ghost commented Jul 27, 2018

No description provided.

@coveralls
Copy link

coveralls commented Jul 27, 2018

Pull Request Test Coverage Report for Build 695

  • 1 of 11 (9.09%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 71.212%

Changes Missing Coverage Covered Lines Changed/Added Lines %
algorithms/backtrack/generate_parenthesis.py 1 11 9.09%
Totals Coverage Status
Change from base Build 685: -0.1%
Covered Lines: 3854
Relevant Lines: 5412

💛 - Coveralls

@@ -27,3 +27,17 @@ def add_pair(res, s, left, right):
res = []
add_pair(res, "", n, 0)
return res


def generate_parenthesis_(n):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests in the tests folder (tests/test_backtrack.py).
Rename the new version as generate_parenthesis_v2(), also change the original version name to generate_parenthesis_v1().

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are some problems, let me correct it and push it later.

res.append(s)
if left > 0:
add_pair(res, s+"(", left-1, right)
if right > 0 && left<right:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write and instead of &&

@danghai danghai mentioned this pull request Jul 30, 2018
@danghai
Copy link
Collaborator

danghai commented Jul 30, 2018

@RenliangShi Could you solve the problem in Travis?

@ghost ghost closed this Jul 31, 2018
@danghai
Copy link
Collaborator

danghai commented Jul 31, 2018

Hi @RenliangShi, why do you close the PR? You intend to create new PR for it?

@ghost
Copy link
Author

ghost commented Aug 6, 2018 via email

This pull request was closed.
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.

None yet

4 participants