Eagle233-Blog

Eagle233-Blog

dev-mdsuper


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


[Algorithms] LeetCode 142. 环形链表 II


Categories Algorithms LinkedList | Tags

来源:代码随想录 LeetCode 142. 环形链表 II 双指针没什么好说的,写到就是赚到,没写到就偶偶偶买嘎了。 一个走1一个走2,碰到的时候同时移动头节点和其中一个节点,相遇的就是入...


[Algorithms] LeetCode 面试题 02.07. 链表相交


Categories Algorithms LinkedList | Tags

来源:代码随想录 LeetCode 面试题 02.07. 链表相交 求长度之差比谁长,谁长谁先走,最后一起走,走到一样的就返回。 /** * Definition for singly-l...


[Algorithms] LeetCode 19. 删除链表的倒数第 N 个结点


Categories Algorithms LinkedList | Tags

来源:代码随想录 LeetCode 19. 删除链表的倒数第 N 个结点 双指针虚拟头节点很管用,经常能够应付莫名其妙的空指针问题。其实也不是莫名其妙,只是能给自己少找点麻烦。就像高中的时候...


[Algorithms] LeetCode 24. 两两交换链表中的节点


Categories Algorithms LinkedList | Tags

来源:代码随想录 LeetCode 24. 两两交换链表中的节点 三指针三指针,其中当前指针只要定义一个,其他两个在while循环里面定义就好,这样在判断时只有一个变量,也只要改变一次cur...



© 2025 Eagle233
Powered By Hexo & Theme mdsuper
Search