Add a similar and maybe more understandable algorithm of generate_parenthesis · Pull Request #381 · keon/algorithms · GitHub
Skip to content

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

Closed
ghost wants to merge 2 commits into
masterfrom
unknown repository
Closed

ghost wants to merge 2 commits into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Jul 27, 2018

Copy link
Copy Markdown

No description provided.

@coveralls

coveralls commented Jul 27, 2018

Copy link
Copy Markdown

return res


def generate_parenthesis_(n):

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

danghai commented Jul 30, 2018

Copy link
Copy Markdown
Collaborator

@RenliangShi Could you solve the problem in Travis?

@ghost ghost closed this Jul 31, 2018
@danghai

danghai commented Jul 31, 2018

Copy link
Copy Markdown
Collaborator

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

@ghost

ghost commented Aug 6, 2018 via email

Copy link
Copy Markdown
Author

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.

4 participants