Eagle233-Blog

Categories HashTable

8 posts

[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: ...

[Algorithms] LeetCode 1. 两数之和


Categories Algorithms HashTable | Tags

来源:代码随想录 LeetCode 1. 两数之和 迭代器用法要保存下标,所以用map。注意迭代器用法。 class Solution { public: vector&l...

[Algorithms] LeetCode 202. 快乐数


Categories Algorithms HashTable | Tags

来源:代码随想录 LeetCode 202. 快乐数 用unordered_set保存出现过的结果四刷:先插入再更新。 class Solution { public: i...

[Algorithms] LeetCode 349. 两个数组的交集


Categories Algorithms HashTable | Tags

来源:代码随想录 LeetCode 349. 两个数组的交集 unordered_set考察unordered_set用法。注意插入操作、查询操作、转换为别的容器的做法。 class Sol...

[Algorithms] LeetCode 242. 有效的字母异位词


Categories Algorithms HashTable | Tags

来源:代码随想录 LeetCode 242. 有效的字母异位词 数组作为哈希表class Solution { public: bool isAnagram(string ...


© 2025 Eagle233
Powered By Hexo & Theme mdsuper
Search