自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(15)
  • 资源 (2)
  • 收藏
  • 关注

转载 C++ memcpy和memmove实现

memcopy和memmove函数在linux下看了一下两个函数的源码。两个函数都在头文件string.h中定义,函数原型为:void * __cdecl memcpy ( void * dst,const void * src,size_t count);void * __cdecl memmove ( void * dst,const void * src,size_t count);实现代码如下:void * __cdecl memcpy ( void * dst,const void *

2020-10-13 18:43:06 356

原创 Docker cgroups作用(十)

实现 cgroups的主要目的是为不同用户层面的资源管理,提供一个统一化的接口。从单个任务的资源控制到操作系统层面的虚拟化, groups提供了以下四大功能。资源限制:groups可以对任务使用的资源总额进行限制。如设定应用运行时使用内存的上限,一旦超过这个配额就发出OOM( Out of Memory)提示。优先级分配:通过分配的CPU时间片数量及磁盘O带宽大小,实际上就相当于控制了任务运行的优先级。资源统计: groups可以统计系统的资源使用量,如CPU使用时长、内存用量等,这个功能非常适用于

2020-10-08 23:33:27 452

原创 Docker namespace技术(九)

1. UTS namespaceUTS(UNIX Time-sharing System)namespace提供了主机名和域名的隔离,这样每个Docker容器就可以拥有独立的主机名和域名了,在网络上可以被视为一个独立的节点,而非宿主机上的一个进程。Docker中,每个镜像基本都以只身所提供的服务名称来命名镜像的hostname,且不会对宿主机产生任何影响,其原理就是利用了UTS namespace。2. IPC namespace进程间通信(Inter-Process Communication,IP

2020-10-08 23:21:17 406

原创 leetcode算法题--构建乘积数组

原题链接:https://leetcode-cn.com/problems/gou-jian-cheng-ji-shu-zu-lcof/class Solution {public: vector<int> constructArr(vector<int>& a) { int n = a.size(); vector<int> b(n, 1); for (int i = 1; i < n; i++

2020-10-04 02:27:59 175

原创 leetcode算法题--求1+2+…+n

原题链接:https://leetcode-cn.com/problems/qiu-12n-lcof/int sumNums(int n) { n && (n += sumNums(n - 1)); return n;}

2020-10-04 02:17:56 276

原创 leetcode算法题--队列的最大值

【代码】leetcode算法题--队列的最大值。

2020-10-04 01:47:18 270

原创 leetcode算法题--数组中数字出现的次数 II

原题链接:https://leetcode-cn.com/problems/shu-zu-zhong-shu-zi-chu-xian-de-ci-shu-ii-lcof/int singleNumber(vector<int>& nums) { int ones = 0, twos = 0; for (int num : nums) { ones = ones ^ num & ~twos; twos = twos ^ num &a

2020-10-04 01:02:34 140

原创 leetcode算法题--数组中数字出现的次数

原题链接:https://leetcode-cn.com/problems/shu-zu-zhong-shu-zi-chu-xian-de-ci-shu-lcof/vector<int> singleNumbers(vector<int>& nums) { int ret = 0; for (int n : nums) ret ^= n; int div = 1; while ((div & ret) == 0) div &lt

2020-10-04 00:47:32 341

原创 leetcode算法题--礼物的最大价值

原题链接:https://leetcode-cn.com/problems/li-wu-de-zui-da-jie-zhi-lcof/动态规划dp[i][j]表示到(i,j)这个点的最大价值状态转移dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) + grid[i][j]代码int maxValue(vector<vector<int>>& grid) { int m = grid.size(), n = grid[

2020-10-03 23:28:49 449

原创 leetcode算法题--把数字翻译成字符串

原题链接:https://leetcode-cn.com/problems/ba-shu-zi-fan-yi-cheng-zi-fu-chuan-lcof/相似题目:解码方法动态规划:dp[i]表示以位置i为结尾的字符串情况有多少种状态转移dp[i] = dp[i - 1] + dp[i - 2] //当s[i - 1]s[i]构成字符串dp[i] = dp[i - 1] //当s[i - 1]s[i]不构成字符串代码:int translateNum(int num) { ma

2020-10-03 20:06:01 196

原创 leetcode算法题--把数组排成最小的数

原题链接:https://leetcode-cn.com/problems/ba-shu-zu-pai-cheng-zui-xiao-de-shu-lcof/string minNumber(vector<int>& nums) { vector<string> str; string ans; for (int i = 0; i < nums.size(); i++) { str.push_back(to_string(num

2020-10-02 23:48:37 273

原创 leetcode算法题--数字序列中某一位的数字

原题链接:https://leetcode-cn.com/problems/shu-zi-xu-lie-zhong-mou-yi-wei-de-shu-zi-lcof/int findNthDigit(int n) { int digit = 1; long start = 1; long count = 9; while (n > count) { n -= count; digit += 1; start *= 10

2020-10-02 23:28:45 217

原创 leetcode算法题--1~n整数中1出现的次数

原题链接:https://leetcode-cn.com/problems/1nzheng-shu-zhong-1chu-xian-de-ci-shu-lcof/int countDigitOne(int n) { long digit = 1, res = 0; int high = n / 10, cur = n % 10, low = 0; while (high != 0 || cur != 0) { if (cur == 0) {//当cur=0时,1的出

2020-10-02 22:48:02 173 1

原创 leetcode算法题--字符串的排列

原题链接:https://leetcode-cn.com/problems/zi-fu-chuan-de-pai-lie-lcof/vector<string> res; vector<string> permutation(string s) { dfs(0, s); return res;}void dfs(int x, string s) { if (x == s.size() - 1) { res.push_back(s);

2020-10-02 21:49:00 178

转载 leetcode算法题--二叉搜索树与双向链表

原文链接:https://leetcode-cn.com/problems/er-cha-sou-suo-shu-yu-shuang-xiang-lian-biao-lcof/Node *pre = NULL, *head;Node* treeToDoublyList(Node* root) { if (root == NULL) return NULL; dfs(root); head->left = pre;//head指向头节点,pre指向尾节点 pre-&g

2020-10-02 20:12:54 149

docker存储驱动

docker存储驱动介绍,介绍了aufs、btrfs、devicemapper、overlayfs、zfs、vfs六种存储驱动

2018-05-30

go语言revel安装文件

下载后解压放在$GOPATH路径下的src文件夹中即可,具体搭建过程请见我的另一篇博文:http://blog.csdn.net/qq_20817327/article/details/77587145

2017-08-26

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除