Skip to content

Solution for issue #36, Valid Parenthesis in python#164

Open
bpbrum wants to merge 1 commit into
the-vampiire:masterfrom
bpbrum:36-solution
Open

Solution for issue #36, Valid Parenthesis in python#164
bpbrum wants to merge 1 commit into
the-vampiire:masterfrom
bpbrum:36-solution

Conversation

@bpbrum

@bpbrum bpbrum commented Oct 24, 2019

Copy link
Copy Markdown

Dear the-vampiire,
this is my solution for Issue 36, Valid Parenthesis, in python

Approach / Though Process
From the start, I felt pairwise comparison was the way to go, and indeed it evolved naturally. I decided also to add a test against empty strings right at the beginning to avoid the burden of making all the comparisons if it was supposed to return True anyway. I re-used my "testing" function from the PR for Issue 3, but I feel it could be improved.

Problems during the solution process
As mentioned before, the solutione evolved naturally, and I had basically no problems.

Instructions to run
The file is coded to run the tests on import or open (harcoded into name == "main"), but the function has_valid_parens can be imported for testing. The input is a merely a string.

-- bpbrum

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.

1 participant