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 String Length After Removing Substrings #1

Open
farhan-sayeed opened this issue Oct 7, 2024 · 2 comments
Open

Minimum String Length After Removing Substrings #1

farhan-sayeed opened this issue Oct 7, 2024 · 2 comments
Assignees

Comments

@farhan-sayeed
Copy link

Implement solution for the below problem statement

You are given a string s consisting only of uppercase English letters.

You can apply some operations to this string where, in one operation, you can remove any occurrence of one of the substrings "AB" or "CD" from s.

Return the minimum possible length of the resulting string that you can obtain.

Note that the string concatenates after removing the substring and could produce new "AB" or "CD" substrings.

Example 1:

Input: s = "ABFCACDB"
Output: 2
Explanation: We can do the following operations:
- Remove the substring "ABFCACDB", so s = "FCACDB".
- Remove the substring "FCACDB", so s = "FCAB".
- Remove the substring "FCAB", so s = "FC".
So the resulting length of the string is 2.
It can be shown that it is the minimum length that we can obtain.

Example 2:

Input: s = "ACBBD"
Output: 5
Explanation: We cannot do any operations on the string so the length remains the same.

Constraints:

  • 1 <= s.length <= 100
  • s consists only of uppercase English letters.
@farhan-sayeed
Copy link
Author

@Ash914027 Can you assign this to me with #hactoberfest2024 & #hacktoberfest-accepted tag

@Samruddhi345A
Copy link

Hi,Please assign me this task.

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

No branches or pull requests

2 participants