/images/avatar.png

lc680. Valid Palindrome II

Given a string s, return true if the s can be palindrome after deleting at most one character from it. Example 1: 1 2 Input: s = "aba" Output: true Example 2: 1 2 3 Input: s = "abca" Output: true Explanation: You could delete the character 'c'. Example 3: 1 2 Input: s = "abc" Output: false Constraints: 1 <= s.length <= 105 s consists of lowercase English letters. 解题思路: 如果最多删除一个字母可以使字符串满足回文序列即返回true。

lc953. Verifying an Alien Dictionary

In an alien language, surprisingly, they also use English lowercase letters, but possibly in a different order. The order of the alphabet is some permutation of lowercase letters. Given a sequence of words written in the alien language, and the order of the alphabet, return true if and only if the given words are sorted lexicographically in this alien language. Example 1: 1 2 3 Input: words = ["hello","leetcode"], order = "hlabcdefgijkmnopqrstuvwxyz" Output: true Explanation: As 'h' comes before 'l' in this language, then the sequence is sorted.

lc1249. Minimum Remove to Make Valid Parentheses

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 with B), where A and B are valid strings, or It can be written as (A), where A is a valid string.