Skip to content

Instantly share code, notes, and snippets.

@nikasulo
Last active August 28, 2019 23:31
Show Gist options
  • Save nikasulo/27d352ffd310c01ef0fda9b0ccf25ea2 to your computer and use it in GitHub Desktop.
Save nikasulo/27d352ffd310c01ef0fda9b0ccf25ea2 to your computer and use it in GitHub Desktop.
Initialize function
def balanced_brackets?(string)
#Initialize Stack
s = Stack.new
for i in 0...string.length do
#Rest of the code in here
end
#When we come out of the loop, if our stack is not empty, then we have a problem
return false if s.first.next_node
#If our edge cases don't fail, return true
return true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment