【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 ...
View Code 76. Minimum Window Substring 题意:找出s串的最短连续子串包含t串中的所有字符 我的思路:hash记录t串中个字符个数,首尾两指针i、j,往后扫j的位置,即包含了t串中所有字符,在把i往后缩,j-i小的话更新结果 我的代码: View Code 77. Combinations 题意:输出1-n的所有个数为k的组合,不重复 我...
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...
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()||...
大话数据结构-多路查找树(B树)_小地盘的诺克萨斯-CSDN博客_多路查找树 6、优秀的算法书 在这里我也...
<span style="color:#333333;">classSolution{public:vector<int>findSubstring(string s,vector<string>&words){unordered_map<string,int>mp;vector<int>result;unordered_map<string,int>::iterator it;int len=words[0].length(),num=words.size();for(int i=0;i<len;i++)//起点{for(int i=0;i...
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) ...
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/...
LeetCode 76. 最小覆盖子串 https://leetcode-cn.com/problems/minimum-window-substring/ 1.unordered_map快很多,使用map会超时。 2.滑动窗口(双指针)适用条件: 1.从一个数组中找出连续的子段,这个子段要满足某种条件。 2.扩充这个段后任然满足这个条件。 首先找出从开始位置开始满足条件的子段,然后缩小左边...