原文链接: https://leetcode-cn.com/problems/valid-parenthesis-string 英文原文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…
标签详情
字符串 分类
原文链接: https://leetcode-cn.com/problems/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: Input: s = "aba" Output: true Example 2: Input: s = "abca" Output: true E…
原文链接: https://leetcode-cn.com/problems/repeated-string-match 英文原文Given two strings a and b, return the minimum number of times you should repeat string a so that string b is a substring of it. If it is impossible for b to be a substring of a af…
原文链接: https://leetcode-cn.com/problems/top-k-frequent-words 英文原文Given an array of strings words and an integer k, return the k most frequent strings. Return the answer sorted by the frequency from highest to lowest. Sort the words with the same frequ…
原文链接: https://leetcode-cn.com/problems/count-binary-substrings 英文原文Give a binary string s, return the number of non-empty substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in these substrings are grouped consecutive…
原文链接: https://leetcode-cn.com/problems/minimum-ascii-delete-sum-for-two-strings 英文原文Given two strings s1 and s2, return the lowest ASCII sum of deleted characters to make two strings equal. Example 1: Input: s1 = "sea", s2 = "eat" Output: 231 Explana…
原文链接: https://leetcode-cn.com/problems/longest-word-in-dictionary 英文原文Given an array of strings words representing an English Dictionary, return the longest word in words that can be built one character at a time by other words in words. If there is …
原文链接: https://leetcode-cn.com/problems/accounts-merge 英文原文Given a list of accounts where each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements are emails representing emails of t…
原文链接: https://leetcode-cn.com/problems/remove-comments 英文原文Given a C++ program, remove comments from it. The program source is an array of strings source where source[i] is the ith line of the source code. This represents the result of splitting the …
原文链接: https://leetcode-cn.com/problems/count-different-palindromic-subsequences 英文原文Given a string s, return the number of different non-empty palindromic subsequences in s. Since the answer may be very large, return it modulo 109 + 7. A subsequence …
原文链接: https://leetcode-cn.com/problems/parse-lisp-expression 英文原文You are given a string expression representing a Lisp-like expression to return the integer value of. The syntax for these expressions is given as follows. An expression is either an in…
原文链接: https://leetcode-cn.com/problems/number-of-atoms 英文原文Given a string formula representing a chemical formula, return the count of each atom. The atomic element always starts with an uppercase character, then zero or more lowercase letters, repre…
原文链接: https://leetcode-cn.com/problems/prefix-and-suffix-search 英文原文Design a special dictionary with some words that searchs the words in it by a prefix and a suffix. Implement the WordFilter class: WordFilter(string[] words) Initializes the object w…
原文链接: https://leetcode-cn.com/problems/shortest-completing-word 英文原文Given a string licensePlate and an array of strings words, find the shortest completing word in words. A completing word is a word that contains all the letters in licensePlate. Igno…
原文链接: https://leetcode-cn.com/problems/special-binary-string 英文原文Special binary strings are binary strings with the following two properties: The number of 0's is equal to the number of 1's. Every prefix of the binary string has at least as many 1's …
原文链接: https://leetcode-cn.com/problems/partition-labels 英文原文You are given a string s. We want to partition the string into as many parts as possible so that each letter appears in at most one part. Return a list of integers representing the size of t…
原文链接: https://leetcode-cn.com/problems/reorganize-string 英文原文Given a string s, rearrange the characters of s so that any two adjacent characters are not the same. Return any possible rearrangement of s or return "" if not possible. Example 1: Input: …
原文链接: https://leetcode-cn.com/problems/basic-calculator-iv 英文原文Given an expression such as expression = "e + 8 - a + 5" and an evaluation map such as {"e": 1} (given in terms of evalvars = ["e"] and evalints = [1]), return a list of tokens representi…
原文链接: https://leetcode-cn.com/problems/jewels-and-stones 英文原文You're given strings jewels representing the types of stones that are jewels, and stones representing the stones you have. Each character in stones is a type of stone you have. You want to …
原文链接: https://leetcode-cn.com/problems/swap-adjacent-in-lr-string 英文原文In a string composed of 'L', 'R', and 'X' characters, like "RXXLRXRXL", a move consists of either replacing one occurrence of "XL" with "LX", or replacing one occurrence of "RX" wi…
原文链接: https://leetcode-cn.com/problems/letter-case-permutation 英文原文Given a string s, we can transform every letter individually to be lowercase or uppercase to create another string. Return a list of all possible strings we could create. You can retu…
原文链接: https://leetcode-cn.com/problems/custom-sort-string 英文原文You are given two strings order and s. All the words of order are unique and were sorted in some custom order previously. Permute the characters of s so that they match the order that orde…
原文链接: https://leetcode-cn.com/problems/valid-tic-tac-toe-state 英文原文Given a Tic-Tac-Toe board as a string array board, return true if and only if it is possible to reach this board position during the course of a valid tic-tac-toe game. The board is a…
原文链接: https://leetcode-cn.com/problems/rotate-string 英文原文Given two strings s and goal, return true if and only if s can become goal after some number of shifts on s. A shift on s consists of moving the leftmost character of s to the rightmost positio…
原文链接: https://leetcode-cn.com/problems/unique-morse-code-words 英文原文International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: 'a' maps to ".-", 'b' maps to "-...", 'c' maps to "-.-.", …
原文链接: https://leetcode-cn.com/problems/number-of-lines-to-write-string 英文原文You are given a string s of lowercase English letters and an array widths denoting how many pixels wide each lowercase English letter is. Specifically, widths[0] is the width …
原文链接: https://leetcode-cn.com/problems/expressive-words 英文原文Sometimes people repeat letters to represent extra feeling. For example: "hello" -> "heeellooo" "hi" -> "hiiii" In these strings like "heeellooo", we have groups of adjacent letters that are…
原文链接: https://leetcode-cn.com/problems/subdomain-visit-count 英文原文A website domain "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com" and at the lowest level, "discuss.leet…
原文链接: https://leetcode-cn.com/problems/ambiguous-coordinates 英文原文We had some 2-dimensional coordinates, like "(1, 3)" or "(2, 0.5)". Then, we removed all commas, decimal points, and spaces and ended up with the string s. For example, "(1, 3)" becomes…
原文链接: https://leetcode-cn.com/problems/most-common-word 英文原文Given a string paragraph and a string array of the banned words banned, return the most frequent word that is not banned. It is guaranteed there is at least one word that is not banned, and …