View Code 76. Minimum Window Substring 题意:找出s串的最短连续子串包含t串中的所有字符 我的思路:hash记录t串中个字符个数,首尾两指针i、j,往后扫j的位置,即包含了t串中所有字符,在把i往后缩,j-i小的话更新结果 我的代码: View Code 77. Combinations 题意:输出1-n的所有个数为k的组合,不重复 我...
【158】Read N Characters Given Read4 II - Call multiple times 【159】Longest Substring with At Most Two Distinct Characters(2019年1月29日,谷歌tag复习) 给定一个字符串 s,返回它最长的子串的长度,子串要求只能有两个distinct characters。 题解:sliding window。(time complexity is O(N)) View Code ...
76. 最小覆盖子串 Minimum Window Substring 🌟🌟🌟 77. 组合 Combinations 🌟🌟 78. 子集 Subsets 🌟🌟 Golang每日一练(leetDay0027) 79. 单词搜索 Word Search 🌟🌟 80. 删除有序数组中的重复项 II Remove-duplicates-from-sorted-array-II 🌟🌟 81. 搜索旋转排序数组 II Search-in-rota...
1、数据结构 数据结构研究的内容就是如何按一定的逻辑结构,把数据组织起来,一般学习算法都是先从数据结...
classSolution{public:stringminWindow(string s,string t){string ans="";unordered_map<char,int>hash;for(auto&c:t)++hash[c];size_t need=hash.size();for(int i=0,j=0;s[j];++j){if(--hash[s[j]]==0)need--;while(hash[s[i]]<0)++hash[s[i++]];if(need==0&&(ans.empty()|...
Sliding Window #3. Longest Substring Without Repeating Characters (M-) 1400 #76. Minimum Window Substring (M+) 1700 #395. Longest Substring with At Least K Repeating Characters (M+) 1700 #424. Longest Repeating Character Replacement (M) 1500 #713. Subarray Product Less Than K (M) ...
return longStr.substring(i+1).equals(shortStr.substring(i)); } } return true; } } Author 大王兔Posted on November 30, 2016Categories Leetcode, Medium, MicrosoftLeave a comment on 161. One Edit Distance 54. Spiral Matrix Given a matrix of m x n elements (m rows, n columns), return...
3.longest-substring-without-repeating-characters 3.无重复字符的最长子串 7.reverse-integer 37.sudoku-solver 43.multiply-strings 56.merge-intervals 62.unique-paths 64.minimum-path-sum 78.子集 101.symmetric-tree 129.sum-root-to-leaf-numbers 198.house-robber 206.反转链表 220.contains-duplicate-iii ...
LeetCode 刷题随手记 - 第一部分 前 256 题(非会员),仅算法题,的吐槽 https://leetcode.com/problemset/algorithms/...
Given a string S and a string T, find the minimum window in S which wi...Minimum Window Substring 最小覆盖子串算法 转载:https://blog.csdn.net/fly_yr/article/details/51134340 题目 最小子串覆盖 给定一个字符串source和一个目标字符串target,在字符串source中找到包括所有目标字符串字母的最小子串...