会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
pusidun
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
下一页
2020年9月10日
[leetcode]71. 简化路径
摘要: 71. 简化路径 唯一的坑点,"/..."这个示例,"..."是目录名 class Solution { public: string simplifyPath(string path) { deque<string> DQ; istringstream iss(path); string word
阅读全文
posted @ 2020-09-10 09:41 pusidun
阅读(104)
评论(0)
推荐(0)
2020年9月9日
206. 反转链表
摘要: 206. 反转链表 递归 class Solution { public: ListNode* reverseList(ListNode* head) { if(head == nullptr || head->next == nullptr) return head; ListNode* next
阅读全文
posted @ 2020-09-09 11:02 pusidun
阅读(87)
评论(0)
推荐(0)
2020年9月8日
[leetcode]2. 两数相加
摘要: 2. 两数相加 这题medium,但思路挺简单的。模拟下就可以 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x),
阅读全文
posted @ 2020-09-08 23:17 pusidun
阅读(96)
评论(0)
推荐(0)
2020年9月7日
[leetcode]46. 全排列
摘要: 46. 全排列 排列,用回溯法 class Solution { public: vector<vector<int>> permute(vector<int>& nums) { vector<vector<int>> permutation; vector<bool> visited(nums.s
阅读全文
posted @ 2020-09-07 23:26 pusidun
阅读(100)
评论(0)
推荐(0)
[leetcode] 17. 电话号码的字母组合
摘要: 17. 电话号码的字母组合 排列题目,很容易想到回溯。下面是ac代码。 class Solution { private: vector<string> vstrs = {"","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"}; public
阅读全文
posted @ 2020-09-07 16:07 pusidun
阅读(139)
评论(0)
推荐(0)
2020年9月3日
C++17 Fold Expressions
摘要: C++17 Fold Expressions 本文介绍C++17新特性折叠表达式。文章示例代码通过MinGW编译,宏__cplusplus=201703 下面我们从一个模板函数sum开始,介绍折叠表达式。 用折叠表达式简化以前的代码 C++11引入了变长参数模板,我们想求变长参数的和,可以这样写模板
阅读全文
posted @ 2020-09-03 17:22 pusidun
阅读(797)
评论(0)
推荐(0)
2020年8月30日
博客文章分类汇总
摘要: Github Pages博客备份:pusidun's blog Gitee Pages博客备份:pusidun's blog 源码阅读 Redis Redis源码阅读一:简单动态字符串SDS Redis源码阅读二:跳跃表skiplist 读书笔记 奔跑吧Linux内核--ch4并发与同步 C++ C
阅读全文
posted @ 2020-08-30 16:53 pusidun
阅读(174)
评论(0)
推荐(0)
2020年8月17日
go1.14.2 slice源码阅读
摘要: 简介 本文介绍下golang的基本数据结构切片的代码实现。源码基于go1.14.2 给个不严谨的定义,go的切片是一种"动态数组的引用",与C++的vector类型类似,都是线性结构,都有内存分配,都有扩容操作。 TODO文末会附上一个C实现的Slice,供C背景的读者参考 slice定义 代码位于
阅读全文
posted @ 2020-08-17 10:51 pusidun
阅读(172)
评论(0)
推荐(0)
2020年7月17日
gcc5.4.0 shared_ptr源码阅读--引用计数
摘要: 引言 本文探究在gcc5.4.0中,shared_ptr引用计数的实现 相关源码: 来源:Ubuntu 16 路径:/usr/include/c++/5.4.0/bits 文件:shared_ptr_atomic.h shared_ptr_base.h shared_ptr.h shared_ptr
阅读全文
posted @ 2020-07-17 10:57 pusidun
阅读(445)
评论(0)
推荐(0)
2020年6月29日
Leetcode 215. 数组中的第K个最大元素
摘要: 题目 在未排序的数组中找到第 k 个最大的元素。请注意,你需要找的是数组排序后的第 k 个最大的元素,而不是第 k 个不同的元素。 示例 1: 输入: [3,2,1,5,6,4] 和 k = 2 输出: 5 示例 2: 输入: [3,2,3,1,2,4,5,5,6] 和 k = 4 输出: 4 解法
阅读全文
posted @ 2020-06-29 14:44 pusidun
阅读(162)
评论(0)
推荐(0)
上一页
1
2
3
4
5
下一页
公告