Skip to content
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

exercises(matching-brackets): example: avoid using allocator #338

Merged

Conversation

ee7
Copy link
Member

@ee7 ee7 commented Sep 21, 2023

The user is allowed to add their own reasonable conditions to the contract of a tested function. Illustrate one way to avoid using the allocator.

Also, demonstrate adding the closing character to the stack, not the opening one. This makes the body of the helper function look more natural, and slightly reduces the complexity of the longer line in isBalanced.

Refs: #313


To-do:

  • Consider renaming stack to buf.
  • Consider returning false if nesting depth exceeds 100.

The user is allowed to add conditions like this to the doc comment of a
tested function.
@ee7 ee7 requested a review from booniepepper September 21, 2023 13:10
ee7 added 2 commits September 23, 2023 20:00
Add the closing character to the stack, not the opening one.

This makes the body of the helper function look more natural, and
reduces the complexity of the longer line in isBalanced.
@ee7 ee7 merged commit bbb2f23 into exercism:main Oct 4, 2023
@ee7 ee7 deleted the exercises-matching-brackets-example-avoid-allocator branch October 4, 2023 21:38
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