Skip to content

errors in balanced_parentheses.py #620

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
ashwek opened this issue Nov 30, 2018 · 1 comment
Closed

errors in balanced_parentheses.py #620

ashwek opened this issue Nov 30, 2018 · 1 comment

Comments

@ashwek
Copy link
Member

ashwek commented Nov 30, 2018

stack.push(parenthesis)
elif parenthesis == ')':
stack.pop()
return not stack.is_empty()

Line 16 returns wrong result due to not

Line 15 can cause error for inputs like )). before calling pop it should be checked if stack is empty.

there is no module named .Stack. it should be
from stack import Stack

@mikaelsouza
Copy link
Contributor

Oh, I just noticed that you already fixed this issue which makes what I did redundant haha.

I hope the new example can be useful though.

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

No branches or pull requests

2 participants