LeetCode --- 1544. Make The String Great 解题报告

Posted 杨鑫newlfe

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LeetCode --- 1544. Make The String Great 解题报告相关的知识,希望对你有一定的参考价值。

Given a string s of lower and upper case English letters.

A good string is a string which doesn\'t have two adjacent characters s[i] and s[i + 1] where:

  • 0 <= i <= s.length - 2
  • s[i] is a lower-case letter and s[i + 1] is the same letter but in upper-case or vice-versa.

To make the string good, you can choose two adjacent characters that make the string bad and remove them. You can keep doing this until the string becomes good.

Return the string after making it good. The answer is guaranteed to be unique under the given constraints.

Notice that an empty string is also good.

Example 1:

Input: s = "leEeetcode"
Output: "leetcode"
Explanation:

以上是关于LeetCode --- 1544. Make The String Great 解题报告的主要内容,如果未能解决你的问题,请参考以下文章

[LeetCode] 1249. Minimum Remove to Make Valid Parentheses

[LeetCode] 1249. Minimum Remove to Make Valid Parentheses

leetcode1347. Minimum Number of Steps to Make Two Strings Anagram

LeetCode 1347. Minimum Number of Steps to Make Two Strings Anagram

HDU1544 Palindromes回文

HDU 1544 Palindromes(回文字符子串)