string

    [LeetCode] 2370. Longest Ideal Subsequence (Daily Question)

    문제You are given a string s consisting of lowercase letters and an integer k. We call a string t ideal if the following conditions are satisfied:     - t is a subsequence of the string s.     - The absolute difference in the alphabet order of every two adjacent letters in t is less than or equal to k.Return the length of the longest ideal string. A subsequence is a string that can be derived from..

    [LeetCode] 678. Valid Parenthesis String (Daily Question)

    문제 Given a string s containing only three types of characters: '(', ')' and '*', return true if s is valid. The following rules define a valid string: - Any left parenthesis '(' must have a corresponding right parenthesis ')'. - Any right parenthesis ')' must have a corresponding left parenthesis '('. - Left parenthesis '(' must go before the corresponding right parenthesis ')'.'*' - could be tr..

    [LeetCode] 1249. Minimum Remove to Make Valid Parentheses (Daily Question)

    문제 Given a string s of '(' , ')' and lowercase English characters. Your task is to remove the minimum number of parentheses ( '(' or ')', in any positions ) so that the resulting parentheses string is valid and return any valid string. Formally, a parentheses string is valid if and only if: - It is the empty string, contains only lowercase characters, or - It can be written as AB (A concatenated..

    [LeetCode] 1544. Make The String Great (Daily Question)

    문제 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 "aAcC" --> "cC" --> "" 예시를 보면 없애야 하는 부분을 없앴더니 새로운 부분이 생긴 것을 볼 수 있다. 풀이 아이디어 알파벳은 26개로, 같은 알파벳이 대소문자로 붙어있는 경우는 26*2(소문자+대문자, 대문자+소문자), 32가지 밖에 없다. 주어지는 문자열의 길이도 최대 100으로, 짧기 때문에 없애야 하는 부분을 미리 정의해 두고 문자열이 더 이상 바뀌지 않을 때까지 반복하면 좋은 문자열이 될 것이다. ..