-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Conversation
Pull Request Test Coverage Report for Build 695
💛 - Coveralls |
@@ -27,3 +27,17 @@ def add_pair(res, s, left, right): | |||
res = [] | |||
add_pair(res, "", n, 0) | |||
return res | |||
|
|||
|
|||
def generate_parenthesis_(n): |
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.
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()
.
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.
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: |
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.
Write and
instead of &&
@RenliangShi Could you solve the problem in |
Hi @RenliangShi, why do you close the PR? You intend to create new PR for it? |
I have already made a PR for it. #384
Hai Hoang Dang <notifications@github.com> 于2018年8月1日周三 上午5:09写道:
… Hi @RenliangShi <https://github.com/RenliangShi>, why do you close the
PR? You intend to create new PR for it?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#381 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AnRFTKf576CqXAS3ACec6a5gETlPdcAxks5uMMecgaJpZM4Vi2gV>
.
|
No description provided.