Eagle233-Blog

Eagle233-Blog

dev-mdsuper


[Algorithms] LeetCode 28. 找出字符串中第一个匹配项的下标


Categories Algorithms String | Tags

来源:代码随想录 LeetCode 28. 找出字符串中第一个匹配项的下标 KMPKMP实际上是优化过的滑动窗口,只不过优化得有点太巧妙了。 看这个视频:Knuth–Morris–Pratt...


[Algorithms] KamaCoder 55. 右旋字符串(第八期模拟笔试)


Categories Algorithms String | Tags

来源:代码随想录 KamaCoder 55. 右旋字符串(第八期模拟笔试) 三次反转#include <bits/stdc++.h> using namespace std; in...


[Algorithms] LeetCode 151. 反转字符串中的单词


Categories Algorithms String | Tags

来源:代码随想录 LeetCode 151. 反转字符串中的单词 stringstream利用stringstream可以快速分割单词。每个单词反转后再全部反转。 class Solutio...


[Algorithms] KamaCoder 54. 替换数字(第八期模拟笔试)


Categories Algorithms String | Tags

来源:代码随想录 KamaCoder 54. 替换数字(第八期模拟笔试) 双指针每次遇到数字都把第二个指针指向五个元素后,将字符串复制到后面。 #include <bits/stdc+...


[Algorithms] LeetCode 541. 反转字符串 II


Categories Algorithms String | Tags

来源:代码随想录 LeetCode 541. 反转字符串 II 单指针玩几天脑子进水了,这题都不会做了。后继比较难的可以直接用reverse,没必要再自己写了。 class Solution...


[Algorithms] LeetCode 344. 反转字符串


Categories Algorithms String | Tags

来源:代码随想录 LeetCode 344. 反转字符串 单指针class Solution { public: void reverseString(vector<...


[Algorithms] LeetCode 18. 四数之和


Categories Algorithms HashTable | Tags

来源:代码随想录 LeetCode 18. 四数之和 双指针两层for循环,两个剪枝,四个去重。加法数据开long long。 class Solution { public: ...


[Algorithms] LeetCode 15. 三数之和


Categories Algorithms HashTable | Tags

来源:代码随想录 LeetCode 15. 三数之和 双指针上一道三数之和不需要元素查重,但是本题使用map不容易查重,因此使用双指针。可以进行一次剪枝和三次查重。 三刷:双指针内部不要用w...


[Algorithms] LeetCode 383. 赎金信


Categories Algorithms HashTable | Tags

来源:代码随想录 LeetCode 383. 赎金信 unordered_mapclass Solution { public: bool canConstruct(str...


[Algorithms] LeetCode 454. 四数相加 II


Categories Algorithms HashTable | Tags

来源:代码随想录 LeetCode 454. 四数相加 II unordered_mapkey存和,value存出现次数。!!! class Solution { public: ...



© 2026 Eagle233
Powered By Hexo & Theme mdsuper
Search