原文链接: https://leetcode-cn.com/problems/palindrome-pairs 英文原文Given a list of unique words, return all the pairs of the distinct indices (i, j) in the given list, so that the concatenation of the two words words[i] + words[j] is a palindrome. Example 1…
标签详情
字符串 分类
原文链接: https://leetcode-cn.com/problems/reverse-string 英文原文Write a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the input array in-place with O(1) extra memory. Example 1: Input:…
原文链接: https://leetcode-cn.com/problems/reverse-vowels-of-a-string 英文原文Given a string s, reverse only all the vowels in the string and return it. The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both cases. Example 1: Input: s = "hel…
原文链接: https://leetcode-cn.com/problems/ransom-note 英文原文Given two stings ransomNote and magazine, return true if ransomNote can be constructed from magazine and false otherwise. Each letter in magazine can only be used once in ransomNote. Example 1: I…
原文链接: https://leetcode-cn.com/problems/mini-parser 英文原文Given a string s represents the serialization of a nested list, implement a parser to deserialize it and return the deserialized NestedInteger. Each element is either an integer or a list whose e…
原文链接: https://leetcode-cn.com/problems/first-unique-character-in-a-string 英文原文Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1. Example 1: Input: s = "leetcode" Output: 0 Example 2: …
原文链接: https://leetcode-cn.com/problems/longest-absolute-file-path 英文原文Suppose we have a file system that stores both files and directories. An example of one system is represented in the following picture: Here, we have dir as the only directory in t…
原文链接: https://leetcode-cn.com/problems/find-the-difference 英文原文You are given two strings s and t. String t is generated by random shuffling string s and then add one more letter at a random position. Return the letter that was added to t. Example 1: …
原文链接: https://leetcode-cn.com/problems/is-subsequence 英文原文Given two strings s and t, return true if s is a subsequence of t, or false otherwise. A subsequence of a string is a new string that is formed from the original string by deleting some (can b…
原文链接: https://leetcode-cn.com/problems/decode-string 英文原文Given an encoded string, return its decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k i…
原文链接: https://leetcode-cn.com/problems/longest-substring-with-at-least-k-repeating-characters 英文原文Given a string s and an integer k, return the length of the longest substring of s such that the frequency of each character in this substring is greate…
原文链接: https://leetcode-cn.com/problems/remove-k-digits 英文原文Given string num representing a non-negative integer num, and an integer k, return the smallest possible integer after removing k digits from num. Example 1: Input: num = "1432219", k = 3 Out…
原文链接: https://leetcode-cn.com/problems/longest-palindrome 英文原文Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters. Letters are case sensitive, for example…
原文链接: https://leetcode-cn.com/problems/fizz-buzz 英文原文Given an integer n, return a string array answer (1-indexed) where: answer[i] == "FizzBuzz" if i is divisible by 3 and 5. answer[i] == "Fizz" if i is divisible by 3. answer[i] == "Buzz" if i is div…
原文链接: https://leetcode-cn.com/problems/add-strings 英文原文Given two non-negative integers, num1 and num2 represented as string, return the sum of num1 and num2 as a string. You must solve the problem without using any built-in library for handling large…
原文链接: https://leetcode-cn.com/problems/strong-password-checker 英文原文A password is considered strong if the below conditions are all met: It has at least 6 characters and at most 20 characters. It contains at least one lowercase letter, at least one up…
原文链接: https://leetcode-cn.com/problems/reconstruct-original-digits-from-english 英文原文Given a string s containing an out-of-order English representation of digits 0-9, return the digits in ascending order. Example 1: Input: s = "owoztneoer" Output: "01…
原文链接: https://leetcode-cn.com/problems/minimum-genetic-mutation 英文原文A gene string can be represented by an 8-character long string, with choices from 'A', 'C', 'G', and 'T'. Suppose we need to investigate a mutation from a gene string start to a gene…
原文链接: https://leetcode-cn.com/problems/number-of-segments-in-a-string 英文原文You are given a string s, return the number of segments in the string. A segment is defined to be a contiguous sequence of non-space characters. Example 1: Input: s = "Hello, m…
原文链接: https://leetcode-cn.com/problems/find-all-anagrams-in-a-string 英文原文Given two strings s and p, return an array of all the start indices of p's anagrams in s. You may return the answer in any order. An Anagram is a word or phrase formed by rearra…
原文链接: https://leetcode-cn.com/problems/string-compression 英文原文Given an array of characters chars, compress it using the following algorithm: Begin with an empty string s. For each group of consecutive repeating characters in chars: If the group's len…
原文链接: https://leetcode-cn.com/problems/serialize-and-deserialize-bst 英文原文Serialization is converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection li…
原文链接: https://leetcode-cn.com/problems/sort-characters-by-frequency 英文原文Given a string s, sort it in decreasing order based on the frequency of the characters. The frequency of a character is the number of times it appears in the string. Return the s…
原文链接: https://leetcode-cn.com/problems/repeated-substring-pattern 英文原文Given a string s, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. Example 1: Input: s = "abab" Output: true Expl…
原文链接: https://leetcode-cn.com/problems/count-the-repetitions 英文原文We define str = [s, n] as the string str which consists of the string s concatenated n times. For example, str == ["abc", 3] =="abcabcabc". We define that string s1 can be obtained from…
原文链接: https://leetcode-cn.com/problems/unique-substrings-in-wraparound-string 英文原文We define the string s to be the infinite wraparound string of "abcdefghijklmnopqrstuvwxyz", so s will look like this: "...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr…
原文链接: https://leetcode-cn.com/problems/validate-ip-address 英文原文Given a string queryIP, return "IPv4" if IP is a valid IPv4 address, "IPv6" if IP is a valid IPv6 address or "Neither" if IP is not a correct IP of any type. A valid IPv4 address is an IP…
原文链接: https://leetcode-cn.com/problems/concatenated-words 英文原文Given an array of strings words (without duplicates), return all the concatenated words in the given list of words. A concatenated word is defined as a string that is comprised entirely of…
原文链接: https://leetcode-cn.com/problems/ones-and-zeroes 英文原文You are given an array of binary strings strs and two integers m and n. Return the size of the largest subset of strs such that there are at most m 0's and n 1's in the subset. A set x is a s…
原文链接: https://leetcode-cn.com/problems/magical-string 英文原文A magical string s consists of only '1' and '2' and obeys the following rules: The string s is magical because concatenating the number of contiguous occurrences of characters '1' and '2' gene…