随笔分类 -  string 4

409. Longest Palindrome
摘要:Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. This is case sensitive, for example "Aa" is not consi... 阅读全文

posted @ 2018-11-09 11:05 猪猪🐷

686. Repeated String Match
摘要:Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, return -1. For example, with A = "abcd" and B = "cdabcdab". R... 阅读全文

posted @ 2018-11-09 11:02 猪猪🐷

459. Repeated Substring Pattern
摘要:Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase Engl... 阅读全文

posted @ 2018-11-09 10:40 猪猪🐷

28. Implement strStr()
摘要:Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Example 1: Input: haystack = "hello", needle = "ll" Output: 2 Example 2: I... 阅读全文

posted @ 2018-11-08 15:44 猪猪🐷

266. Palindrome Permutation
摘要:Given a string, determine if a permutation of the string could form a palindrome. Example 1: Input: "code" Output: false Example 2: Input: "aab" Output: true Example 3: Input: "carerac" Output: true ... 阅读全文

posted @ 2018-11-08 02:24 猪猪🐷

438. Find All Anagrams in a String
摘要:https://www.youtube.com/watch?v=86fQQ7rVGxA&t=284s Given a string s and a non-empty string p, find all the start indices of p's anagrams in s. Strings consists of lowercase English letters only and ... 阅读全文

posted @ 2018-11-08 02:19 猪猪🐷

760. Find Anagram Mappings
摘要:760. Find Anagram Mappings Given two lists Aand B, and B is an anagram of A. B is an anagram of A means B is made by randomizing the order of the elements in A. We want to find an index mapping P, ... 阅读全文

posted @ 2018-09-20 18:25 猪猪🐷

49 Group Anagrams
摘要:Given an array of strings, group anagrams together. Example: Input: ["eat", "tea", "tan", "ate", "nat", "bat"], Output: [ ["ate","eat","tea"], ["nat", 阅读全文

posted @ 2018-08-09 17:38 猪猪🐷

680 Valid Palindrome II
摘要:Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome. Example 1: Example 2: 阅读全文

posted @ 2018-08-09 17:35 猪猪🐷

242. Valid Anagram
摘要:Given two strings s and t , write a function to determine if t is an anagram of s. Example 1: Example 2: Note:You may assume the string contains only 阅读全文

posted @ 2018-08-09 17:32 猪猪🐷

125. Valid Palindrome
摘要:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Note: For the purpose of this problem, w 阅读全文

posted @ 2018-08-09 17:31 猪猪🐷

导航