![](https://img-blog.csdnimg.cn/20210829192922674.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
31天刷完剑指offer
文章平均质量分 52
数据结构与算法
杉杉来啦
coffe in,code out.
展开
-
31天刷完剑指offer——(第4天) 查找算法
剑指offer 03. 数组中重复的数字 (easy)#pragmaonce#include<vector>#include<algorithm>#include<unordered_set>usingstd::unordered_set;usingstd::vector;/*排序,双指针(时间复杂度N*logN,空间复杂度1)classSolution{public:intfindRepeatNumber(vect...原创 2021-09-01 10:04:49 · 144 阅读 · 3 评论 -
31天刷完剑指offer——(第3天) 字符串
剑指offer 05. 替换空格 (easy)#pragmaonce#include<string>usingstd::string;/*利用辅助字符串存储结果classSolution{public:stringreplaceSpace(strings){stringstr;for(autoch:s){if(ch==''){s...原创 2021-08-31 18:12:44 · 82 阅读 · 0 评论 -
31天刷完剑指offer——(第2天) 链表
剑指offer 06. 从尾到头打印列表 (easy)#pragmaonce#include<vector>#include<stack>usingstd::vector;usingstd::stack;structListNode{intval;ListNode*next;ListNode(intx):val(x),next(NULL){}};/*(先反转链表(迭代)后打印)classSo...原创 2021-08-30 16:29:33 · 176 阅读 · 0 评论 -
31天刷完剑指offer——(第1天) 栈和队列
剑指offer 09. 用两个栈实现队列 (简单)#pragmaonce#include<stack>usingstd::stack;//使用辅助栈classCQueue{private:stack<int>in;//入队列的值都push到栈in中(in栈顶元素正好是队列中最后一个元素,in出栈顺序与出队正好相反)stack<int>out;//将栈in中的值出栈并同时p...原创 2021-08-29 19:09:11 · 142 阅读 · 0 评论