Balanced parentheses#3768
Merged
cclauss merged 8 commits intoOct 29, 2020
Merged
Conversation
cclauss
reviewed
Oct 27, 2020
cclauss
reviewed
Oct 27, 2020
|
|
||
| def is_paired(left_bracket: str, right_bracket: str) -> bool: | ||
| """ | ||
| >>> brackets = {"(" : ")", "[" : "]", "{" : "}"} |
Member
There was a problem hiding this comment.
Let’s make this dict a global named bracket_pairs and then we can eliminate is_paired() because it is the same as bracket_pairs[left_bracket] == right_bracket
Member
Author
|
@cclauss @poyea @dhruvmanila Can you review this PR 👍 |
cclauss
reviewed
Oct 29, 2020
Co-authored-by: Christian Clauss <cclauss@me.com>
cclauss
reviewed
Oct 29, 2020
cclauss
reviewed
Oct 29, 2020
| >>> balanced_parentheses("[()]{}{[()()]()}") | ||
| True | ||
| >>> balanced_parentheses("[(])") | ||
| False |
Member
There was a problem hiding this comment.
Please add a string that has no brackets and also an empty string.
Member
Author
There was a problem hiding this comment.
Done. Please review again.
Co-authored-by: Christian Clauss <cclauss@me.com>
cclauss
approved these changes
Oct 29, 2020
stokhos
pushed a commit
to stokhos/Python
that referenced
this pull request
Jan 3, 2021
* Fixed balanced_parentheses.py
* fixed pre-commit
* eliminate is_paired
* remove unused line
* updating DIRECTORY.md
* Update data_structures/stacks/balanced_parentheses.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add more test cases
* Update data_structures/stacks/balanced_parentheses.py
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
peRFectBeliever
pushed a commit
to peRFectBeliever/Python
that referenced
this pull request
Apr 1, 2021
* Fixed balanced_parentheses.py
* fixed pre-commit
* eliminate is_paired
* remove unused line
* updating DIRECTORY.md
* Update data_structures/stacks/balanced_parentheses.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add more test cases
* Update data_structures/stacks/balanced_parentheses.py
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Panquesito7
pushed a commit
to Panquesito7/Python
that referenced
this pull request
May 13, 2021
* Fixed balanced_parentheses.py
* fixed pre-commit
* eliminate is_paired
* remove unused line
* updating DIRECTORY.md
* Update data_structures/stacks/balanced_parentheses.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add more test cases
* Update data_structures/stacks/balanced_parentheses.py
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
shermanhui
pushed a commit
to shermanhui/Python
that referenced
this pull request
Oct 22, 2021
* Fixed balanced_parentheses.py
* fixed pre-commit
* eliminate is_paired
* remove unused line
* updating DIRECTORY.md
* Update data_structures/stacks/balanced_parentheses.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add more test cases
* Update data_structures/stacks/balanced_parentheses.py
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}.