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

Minimum Add to Make Parentheses String Valid #22

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

TanishaBansal101
Copy link
Contributor

@TanishaBansal101 TanishaBansal101 commented Oct 9, 2024

Pull Request Template

Description

A parentheses string is considered valid if it meets one of the following conditions:

It is an empty string.
It can be written as a concatenation of two valid strings, i.e., AB, where both A and B are valid.
It can be written as (A), where A is a valid string.
You are given a parentheses string s. In one move, you can insert either an opening parenthesis '(' or a closing parenthesis ')' at any position in the string. Your task is to determine the minimum number of moves (insertions) required to make the string valid.

Fixes: #1

Type of Change

-[x] Question Added
-[x] Solution Added
-[x] Bug fix
-[x] New feature
-[x] Documentation update
-[ ] Other (please specify):

Checklist

-[x] I have performed a self-review of my code.
-[x] I have commented my code, particularly in hard-to-understand areas.
-[x] I have made corresponding changes to the documentation (if applicable).
-[x] My changes generate no new warnings.
-[x] I have added tests to cover my changes (if applicable).
-[x] All new and existing tests pass.

@Gyanthakur Gyanthakur self-requested a review October 9, 2024 13:57
@Gyanthakur Gyanthakur merged commit 02ee2f6 into Gyanthakur:main Oct 9, 2024
2 of 5 checks passed
@Gyanthakur
Copy link
Owner

Pull Request Template

Description

A parentheses string is considered valid if it meets one of the following conditions:

It is an empty string. It can be written as a concatenation of two valid strings, i.e., AB, where both A and B are valid. It can be written as (A), where A is a valid string. You are given a parentheses string s. In one move, you can insert either an opening parenthesis '(' or a closing parenthesis ')' at any position in the string. Your task is to determine the minimum number of moves (insertions) required to make the string valid.

Fixes: #1

Type of Change

-[x] Question Added -[x] Solution Added -[x] Bug fix -[x] New feature -[x] Documentation update -[ ] Other (please specify):

Checklist

-[x] I have performed a self-review of my code. -[x] I have commented my code, particularly in hard-to-understand areas. -[x] I have made corresponding changes to the documentation (if applicable). -[x] My changes generate no new warnings. -[x] I have added tests to cover my changes (if applicable). -[x] All new and existing tests pass.

if you have any other query reach out to me

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.

Add Leetcode potd solution
2 participants