原文链接: https://leetcode-cn.com/problems/short-encoding-of-words 英文原文A valid encoding of an array of words is any reference string s and array of indices indices such that: words.length == indices.length The reference string s ends with the '#' charact…
标签详情
字符串 分类
原文链接: https://leetcode-cn.com/problems/shortest-distance-to-a-character 英文原文Given a string s and a character c that occurs in s, return an array of integers answer where answer.length == s.length and answer[i] is the distance from index i to the clos…
原文链接: https://leetcode-cn.com/problems/goat-latin 英文原文You are given a string sentence that consist of words separated by spaces. Each word consists of lowercase and uppercase letters only. We would like to convert the sentence to "Goat Latin" (a made…
原文链接: https://leetcode-cn.com/problems/count-unique-characters-of-all-substrings-of-a-given-string 英文原文Let's define a function countUniqueChars(s) that returns the number of unique characters on s. For example if s = "LEETCODE" then "L", "T", "C", "O…
原文链接: https://leetcode-cn.com/problems/positions-of-large-groups 英文原文In a string s of lowercase letters, these letters form consecutive groups of the same character. For example, a string like s = "abbxxxxzyy" has the groups "a", "bb", "xxxx", "z", a…
原文链接: https://leetcode-cn.com/problems/masking-personal-information 英文原文You are given a personal information string s, representing either an email address or a phone number. Return the masked personal information using the below rules. Email address…
原文链接: https://leetcode-cn.com/problems/find-and-replace-in-string 英文原文You are given a 0-indexed string s that you must perform k replacement operations on. The replacement operations are given as three 0-indexed parallel arrays, indices, sources, and…
原文链接: https://leetcode-cn.com/problems/push-dominoes 英文原文There are n dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push some of the dominoes either to the left or to the right. After each second,…
原文链接: https://leetcode-cn.com/problems/similar-string-groups 英文原文Two strings X and Y are similar if we can swap two letters (in different positions) of X, so that it equals Y. Also two strings X and Y are similar if they are equal. For example, "tars…
原文链接: https://leetcode-cn.com/problems/split-array-into-fibonacci-sequence 英文原文You are given a string of digits num, such as "123456579". We can split it into a Fibonacci-like sequence [123, 456, 579]. Formally, a Fibonacci-like sequence is a list f …
原文链接: https://leetcode-cn.com/problems/guess-the-word 英文原文This is an interactive problem. You are given an array of unique strings wordlist where wordlist[i] is 6 letters long, and one word in this list is chosen as secret. You may call Master.guess(…
原文链接: https://leetcode-cn.com/problems/backspace-string-compare 英文原文Given two strings s and t, return true if they are equal when both are typed into empty text editors. '#' means a backspace character. Note that after backspacing an empty text, the …
原文链接: https://leetcode-cn.com/problems/shifting-letters 英文原文You are given a string s of lowercase English letters and an integer array shifts of the same length. Call the shift() of a letter, the next letter in the alphabet, (wrapping around so that …
原文链接: https://leetcode-cn.com/problems/k-similar-strings 英文原文Strings s1 and s2 are k-similar (for some non-negative integer k) if we can swap the positions of two letters in s1 exactly k times so that the resulting string equals s2. Given two anagram…
原文链接: https://leetcode-cn.com/problems/score-of-parentheses 英文原文Given a balanced parentheses string s, return the score of the string. The score of a balanced parentheses string is based on the following rule: "()" has score 1. AB has score A + B, wh…
原文链接: https://leetcode-cn.com/problems/buddy-strings 英文原文Given two strings s and goal, return true if you can swap two letters in s so the result is equal to goal, otherwise, return false. Swapping letters is defined as taking two indices i and j (0-…
原文链接: https://leetcode-cn.com/problems/decoded-string-at-index 英文原文You are given an encoded string s. To decode the string to a tape, the encoded string is read one character at a time and the following steps are taken: If the character read is a let…
原文链接: https://leetcode-cn.com/problems/uncommon-words-from-two-sentences 英文原文A sentence is a string of single-space separated words where each word consists only of lowercase letters. A word is uncommon if it appears exactly once in one of the senten…
原文链接: https://leetcode-cn.com/problems/find-and-replace-pattern 英文原文Given a list of strings words and a string pattern, return a list of words[i] that match pattern. You may return the answer in any order. A word matches the pattern if there exists a…
原文链接: https://leetcode-cn.com/problems/groups-of-special-equivalent-strings 英文原文You are given an array of strings of the same length words. In one move, you can swap any two even indexed characters or any two odd indexed characters of a string words[…
原文链接: https://leetcode-cn.com/problems/orderly-queue 英文原文You are given a string s and an integer k. You can choose one of the first k letters of s and append it at the end of the string.. Return the lexicographically smallest string you could have af…
原文链接: https://leetcode-cn.com/problems/reverse-only-letters 英文原文Given a string s, reverse the string according to the following rules: All the characters that are not English letters remain in the same position. All the English letters (lowercase or …
原文链接: https://leetcode-cn.com/problems/word-subsets 英文原文You are given two string arrays words1 and words2. A string b is a subset of string a if every letter in b occurs in a including multiplicity. For example, "wrr" is a subset of "warrior" but is …
原文链接: https://leetcode-cn.com/problems/minimum-add-to-make-parentheses-valid 英文原文A parentheses string is valid if and only if: It is the empty string, It can be written as AB (A concatenated with B), where A and B are valid strings, or It can be writ…
原文链接: https://leetcode-cn.com/problems/long-pressed-name 英文原文Your friend is typing his name into a keyboard. Sometimes, when typing a character c, the key might get long pressed, and the character will be typed 1 or more times. You examine the typed …
原文链接: https://leetcode-cn.com/problems/flip-string-to-monotone-increasing 英文原文A binary string is monotone increasing if it consists of some number of 0's (possibly none), followed by some number of 1's (also possibly none). You are given a binary str…
原文链接: https://leetcode-cn.com/problems/stamping-the-sequence 英文原文You are given two strings stamp and target. Initially, there is a string s of length target.length with all s[i] == '?'. In one turn, you can place stamp over s and replace every letter…
原文链接: https://leetcode-cn.com/problems/reorder-data-in-log-files 英文原文You are given an array of logs. Each log is a space-delimited string of words, where the first word is the identifier. There are two types of logs: Letter-logs: All words (except th…
原文链接: https://leetcode-cn.com/problems/find-the-shortest-superstring 英文原文Given an array of strings words, return the smallest string that contains each string in words as a substring. If there are multiple valid strings of the smallest length, return…
原文链接: https://leetcode-cn.com/problems/di-string-match 英文原文A permutation perm of n + 1 integers of all the integers in the range [0, n] can be represented as a string s of length n where: s[i] == 'I' if perm[i] < perm[i + 1], and s[i] == 'D' if perm[…