Categories Array
7 posts[Algorithms] KamaCoder 44. 开发商购买土地(第五期模拟笔试)
Categories Algorithms Array | Tags
来源:代码随想录 KamaCoder 44. 开发商购买土地(第五期模拟笔试) 前缀和Plus。有两种划分,那么分别开两个数组,把二维数组从行列两个方向压缩成列行和,然后再用前缀和。观察到求...
[Algorithms] KamaCoder 58. 区间和(第九期模拟笔试)
Categories Algorithms Array | Tags
来源:代码随想录 KamaCoder 58. 区间和(第九期模拟笔试) 前缀和的思想。 #include <bits/stdc++.h> using namespace std; ...
[Algorithms] LeetCode 59. 螺旋矩阵 II
Categories Algorithms Array | Tags
来源:代码随想录 LeetCode 59. 螺旋矩阵 II 考察基本功啊,区间统一左闭右开,最后记得处理n为奇数的情况。 class Solution { public: ...
[Algorithms] LeetCode 209. 长度最小的子数组
Categories Algorithms Array | Tags
来源:代码随想录 LeetCode 209. 长度最小的子数组 滑动窗口,注意指针什么时候要++。指针最好不要定义在for循环里面,有时候要回去–,很乱,不如直接手动++。 三刷发现忘记左边...
[Algorithms] LeetCode 977. 有序数组的平方
Categories Algorithms Array | Tags
来源:代码随想录 LeetCode 977. 有序数组的平方 双指针法,倒序写进结果数组。 四刷:指针可以取等,为什么? class Solution { public: ...
[Algorithms] LeetCode 27. 移除元素
Categories Algorithms Array | Tags
来源:代码随想录 LeetCode 27. 移除元素 暴力解法这边先要初始化一个size变量,原因是我们需要一直变动size的大小,不希望更改实际size之外的数组部分。 class Sol...
[Algorithms] LeetCode 704. 二分查找
Categories Algorithms Array | Tags
来源:代码随想录 LeetCode 704. 二分查找 注意区间的写法,我这里是左闭右开。CPP中很多STL容器都是左闭右开的,统一一下写法。 class Solution { p...
© 2025 Eagle233
Powered By Hexo & Theme mdsuper