Skip to content

[Valid Parentheses] Some improvements #23

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

Closed
wants to merge 1 commit into from
Closed

[Valid Parentheses] Some improvements #23

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Nov 13, 2014

  1. check invalid characters
  2. check invalid string length
  3. reduce redundant code to clarify the logic

1. check invalid characters
2. check invalid string length
3. reduct redundant code to clarify the logic
@ghost ghost changed the title some improvements [Valid Parentheses] Some improvements Nov 13, 2014
@haoel
Copy link
Owner

haoel commented Nov 17, 2014

thanks for this pull request, and can we discuss whether code new logic is easy to read? for me, I think it does simplify the code, but looks a bit far away the human's logic.

@ghost
Copy link
Author

ghost commented Nov 17, 2014

You didn't use any break in the loop, so I think the last return statement only make sense when the stack is empty. And since you are using the stack without break, I thought you know why the stack must be empty.

@ghost
Copy link
Author

ghost commented Nov 17, 2014

Oh, I should say s instead of stack.

@haoel haoel closed this in a54003a Dec 30, 2014
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.

2 participants