Skip to content

1544. Make The String Great #283

Answered by mah-shamim
mah-shamim asked this question in Q&A
Discussion options

You must be logged in to vote

The problem asks us to make a given string "good" by removing adjacent characters that form a "bad pair." A "bad pair" is defined as two adjacent characters where one is the uppercase version of the other (or vice versa). The goal is to repeatedly remove these bad pairs until no more exist in the string.

Key Points:

  • The string consists of lowercase and uppercase English letters.
  • A "bad pair" occurs when a character is the lowercase version of the next character, or the next character is the uppercase version of the previous character.
  • We must return the string after removing all bad pairs.
  • The solution should be efficient given the constraints (1 <= s.length <= 100).

Approach:

  1. Stack-b…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@basharul-siddike
Comment options

@mah-shamim
Comment options

mah-shamim Jan 26, 2025
Maintainer Author

Answer selected by basharul-siddike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested easy Difficulty
2 participants