problem 438. Find All Anagrams in a String solution1: class Solution { public: vector<int> findAnagrams(string s, string p) { if(s.empty()) return {}; vector<, ); for(auto a:p) pv[a]++; int sn = s.size(); ; while(i<sn) { vector<int> tmp…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 滑动窗口 双指针 日期 题目地址:https://leetcode.com/problems/find-all-anagrams-in-a-string/description/ 题目描述 Given a string s and a non-empty string p, find all the start indices of p's anag…
Input: s: "abab" p: "ab" Output: [0, 1, 2] Explanation: The substring with start index = 0 is "ab", which is an anagram of "ab". The substring with start index = 1 is "ba", which is an anagram of "ab&…
Difficulty:easy  More:[目录]LeetCode Java实现 Description https://leetcode.com/problems/first-unique-character-in-a-string/ Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Examples: s =…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 栈 日期 题目地址:https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string/ 题目描述 Given a string S of lowercase letters, a duplicate removal consists of choosing two adjac…
class Solution(object):    def findAnagrams(self, s, p):        """        :type s: str        :type p: str        :rtype: List[int]        """        reslist=[];sdic={};pdic={}        ls=len(s)        lp=len(p)              …
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 栈 日期 题目地址:https://leetcode-cn.com/contest/weekly-contest-185/problems/reformat-the-string/ 题目描述 给你一个混合了数字和字母的字符串 s,其中的字母均为小写英文字母. 请你将该字符串重新格式化,使得任意两个相邻字符的类型都不同.也就是说,字母后面应该跟着数字,而…
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 暴力遍历 日期 题目地址:https://leetcode-cn.com/problems/string-matching-in-an-array/ 题目描述 给你一个字符串数组 words ,数组中的每个字符串都可以看作是一个单词.请你按 任意 顺序返回 words 中是其他单词的子字符串的所有单词. 如果你可以删除 words[j] 最左侧和/或最…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.com/problems/first-unique-character-in-a-string/description/ 题目描述 Given a string, find the first non-repeating character in it and return it's index. I…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 统计 正则表达式 字符串分割 日期 题目地址:https://leetcode.com/problems/number-of-segments-in-a-string/#/description 题目描述 Count the number of segments in a string, where a segment is defined to b…