Skip to content

Add optimized Java solution for Valid Parenthesis String (LeetCode 678)#701

Merged
ghostmkg merged 1 commit intoghostmkg:mainfrom
Piyush-Kumar62:add-valid-parenthesis-java
Oct 14, 2025
Merged

Add optimized Java solution for Valid Parenthesis String (LeetCode 678)#701
ghostmkg merged 1 commit intoghostmkg:mainfrom
Piyush-Kumar62:add-valid-parenthesis-java

Conversation

@Piyush-Kumar62
Copy link
Contributor

Hey! I added a Java solution for the LeetCode problem Valid Parenthesis String (678).

Implemented a greedy approach using lower/upper bounds (O(n) time, O(1) space).
Added a two-pass approach as another way to solve it.
Included a main method with sample tests to check different cases.
Code is clean, commented, and easy to understand.

References:
https://leetcode.com/problems/valid-parenthesis-string/
https://leetcode.com/problems/valid-parenthesis-string/solutions/

@ghostmkg ghostmkg merged commit afbcfe7 into ghostmkg:main Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants