Conversation
CheezItMan
reviewed
Apr 28, 2021
CheezItMan
left a comment
There was a problem hiding this comment.
I gave feedback on the matching parens problem. The Queue wasn't done with a circular buffer so it really isn't what was asked. Otherwise well done.
|
|
||
| # unfinished not passing, but can you give some feedback on my approach | ||
|
|
||
| def balanced(string) |
There was a problem hiding this comment.
Maybe set up a dictionary where the keys are the close markers ), }, ] and the values are the matching open characters. Then you can do if the current character isn't a key in the hash you can push it onto the stack, if it IS a close character, you can then compare
return false if char_hash[char] != stack.pop()| @@ -1,28 +1,29 @@ | |||
| class Queue | |||
|
|
|||
| def initialize | |||
There was a problem hiding this comment.
The Queue is supposed to be done with a circular buffer so...
| @@ -1,19 +1,20 @@ | |||
| class Stack | |||
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.
Stacks and Queues
Thanks for doing some brain yoga. You are now submitting this assignment!
Comprehension Questions
OPTIONAL JobSimulation