1 2 3 4 5 ··· 36 下一页
摘要: 这个题目和 leetcode 171类似。 C++ class Solution { public: string convertToTitle(int columnNumber) { string sb = ""; while (columnNumber > 0) { columnNumber - 阅读全文
posted @ 2024-02-15 19:20 repinkply 阅读(11) 评论(0) 推荐(0)
摘要: 需要好好研究各种写法。 C++解法 class Solution { public: vector<vector<string>> groupAnagrams(vector<string>& strs) { vector<vector<string>> result; if (strs.size() 阅读全文
posted @ 2024-02-14 23:14 repinkply 阅读(16) 评论(0) 推荐(0)
摘要: 解题关键点:用递归方法 class Solution { public: vector<string> mapping = { "abc","def","ghi","jkl", "mno","pqrs","tuv","wxyz"}; void combinations(string digits, 阅读全文
posted @ 2024-02-14 20:45 repinkply 阅读(11) 评论(0) 推荐(0)
摘要: 这个题目的有些类似实现 strStr 这个算法题目。 解题关键点: 1.采用类似滑动窗口的算法遍历字符串s。 2.用两个哈希表保存字符串s和字符串p,中每个小写字母出现的次数。 C++代码: class Solution { public: bool equals(vector<int>& sc, 阅读全文
posted @ 2024-02-14 19:19 repinkply 阅读(23) 评论(0) 推荐(0)
摘要: 为什么要引入内存池算法? 我们知道C/C++ 语言中通过 malloc 调用 sbrk 和 mmap 这两个系统调用,向操作系统申请堆内存。但是,sbrk 和 mmap 这两个系统调用分配内存效率比较低,因为,执行系统调用是要进入内核态的,这样内核态又要转向用户态,运行态的切换会耗费不少时间。至于为 阅读全文
posted @ 2023-01-02 22:51 repinkply 阅读(76) 评论(0) 推荐(0)
摘要: 话题引入 在Linux 内核中很多C语言结构体的写法是下面这样的。 结构体成员变量之前为什么有这么多 . ?,其实这样的写法是为了引用一个函数指针,可以看一下下面这个demo 就明白了。 #include <unistd.h> #include <string.h> #include <stdio. 阅读全文
posted @ 2023-01-02 19:33 repinkply 阅读(134) 评论(0) 推荐(0)
摘要: 简单概念 fd #include <unistd.h> #include <string.h> int main(int argc,char* argv[]) { char buf[20]={0}; read(0,buf,15); write(1,buf,strlen(buf)); return 0 阅读全文
posted @ 2023-01-02 17:47 repinkply 阅读(68) 评论(0) 推荐(0)
摘要: 一、 pattern \ { n \ } :只用来匹配前面 pattern 出现次数。n 为次数。 举例:匹配test.txt中数字出现2次。 匹配test.txt中数字出现2次,并且要以数字开头。 二、 pattern \ { n, \ } : 只含义同上,但次数最少为 n 匹配test.txt中 阅读全文
posted @ 2023-01-01 18:49 repinkply 阅读(52) 评论(0) 推荐(0)
摘要: 模板模板参数 模板模板参数(Template Template Parameters):就是让模板参数本身成为模板。a)类型模板参数 b) 非类型模板参数 c) 模板模板参数。 #include <iostream> #include <list> #include <vector> #includ 阅读全文
posted @ 2022-12-31 20:53 repinkply 阅读(41) 评论(0) 推荐(0)
摘要: 基本概念 类模板中的成员函数,只有源程序代码中出现调用这些成员函数的代码时,这些成员函数才会出现在一个实例化了的类模板中。类模板中的成员函数模板,只有源程序中出现调用这些成员函数模板的代码时,这些成员函数的具体实例才会出现在一个实例化了的类模板中。目前编译器并不支持虚成员函数模板:因为虚函数表vtb 阅读全文
posted @ 2022-12-31 18:06 repinkply 阅读(142) 评论(0) 推荐(0)
1 2 3 4 5 ··· 36 下一页