-
Notifications
You must be signed in to change notification settings - Fork 20.5k
feat: Add ValidParentheses utility with tests #6734
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
base: master
Are you sure you want to change the base?
feat: Add ValidParentheses utility with tests #6734
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6734 +/- ##
============================================
- Coverage 76.80% 76.80% -0.01%
- Complexity 6047 6054 +7
============================================
Files 719 720 +1
Lines 20342 20358 +16
Branches 3940 3945 +5
============================================
+ Hits 15624 15635 +11
- Misses 4127 4130 +3
- Partials 591 593 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ad030d1
to
3d3f61a
Compare
Hi @DenizAltunkapan, @yanglbme, and @alxkm All linter issues (Checkstyle, PMD, Clang format) have been fixed. Looking forward to your review! |
Looks like some similar class already exist |
Thanks for pointing that out, @alxkm! This version also enforces the utility class pattern, satisfies PMD and Checkstyle rules, and focuses on algorithmic demonstration rather than input validation. If preferred, you may merge these improvements into the existing one or move this implementation to a more suitable location. I'm grateful for this experience! |
Summary
This PR adds a new utility class
ValidParentheses
that checks if a given string of parentheses is valid.It supports '()', '{}', and '[]' and ensures correct nesting and ordering.
Features
isValid(String str)
checks if the input string has valid parentheses.ValidParenthesesTest
.Testing
All tests have been verified locally and passed successfully.
References
main
method.This contribution follows the repository’s naming conventions and code style.