Skip to content

Update 0022-generate-parentheses.java #3403

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

Merged
merged 1 commit into from
Aug 4, 2024

Conversation

an0nh4x0r
Copy link
Contributor

@an0nh4x0r an0nh4x0r commented Apr 20, 2024

Important

Please make sure the file name is lowercase and a duplicate file does not already exist before merging.

@an0nh4x0r
Copy link
Contributor Author

@neetcode-gh updated the way stack was iterated using shorter and much concise syntax for this problem, using the java's enhanced for loop

@Tetsuya3850
Copy link
Collaborator

Hi, thank you for the contribution! Agree that the code you provided is better. Since String is immutable, adding would re-create the string every time which is inefficient. StringBuilder makes much more sense.

@Tetsuya3850 Tetsuya3850 merged commit 44b0e00 into neetcode-gh:main Aug 4, 2024
@an0nh4x0r
Copy link
Contributor Author

Awesome 😎

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