原文链接: https://leetcode-cn.com/problems/implement-strstr 英文原文Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Clarification: What should we return when needle is an empty stri…
标签详情
字符串匹配 分类
原文链接: 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/subtree-of-another-tree 英文原文Given the roots of two binary trees root and subRoot, return true if there is a subtree of root with the same structure and node values of subRoot and false otherwise. A subtree of a …
原文链接: 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/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/longest-happy-prefix 英文原文A string is called a happy prefix if is a non-empty prefix which is also a suffix (excluding itself). Given a string s, return the longest happy prefix of s. Return an empty string "" if…
原文链接: https://leetcode-cn.com/problems/find-all-good-strings 英文原文Given the strings s1 and s2 of size n and the string evil, return the number of good strings. A good string has size n, it is alphabetically greater than or equal to s1, it is alphabeti…
原文链接: https://leetcode-cn.com/problems/string-matching-in-an-array 英文原文Given an array of string words. Return all strings in words which is substring of another word in any order. String words[i] is substring of words[j], if can be obtained removing …
原文链接: https://leetcode-cn.com/problems/check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence 英文原文Given a sentence that consists of some words separated by a single space, and a searchWord, check if searchWord is a prefix of any word in sentenc…
原文链接: https://leetcode-cn.com/problems/maximum-repeating-substring 英文原文For a string sequence, a string word is k-repeating if word concatenated k times is a substring of sequence. The word's maximum k-repeating value is the highest value k where word…
原文链接: https://leetcode-cn.com/problems/string-rotation-lcci 英文原文Given two strings, s1 and s2, write code to check if s2 is a rotation of s1 (e.g.,"waterbottle" is a rotation of"erbottlewat"). Can you use only one call to the method that checks if one…
原文链接: https://leetcode-cn.com/problems/check-subtree-lcci 英文原文T1 and T2 are two very large binary trees. Create an algorithm to determine if T2 is a subtree of T1. A tree T2 is a subtree of T1 if there exists a node n in T1 such that the subtree of n…
原文链接: https://leetcode-cn.com/problems/multi-search-lcci 英文原文Given a string band an array of smaller strings T, design a method to search b for each small string in T. Output positions of all strings in smalls that appear in big, where positions[i] i…