会员
周边
捐助
新闻
博问
闪存
赞助商
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
canexjtuzju
记录
Powered by
博客园
博客园
|
首页
|
新随笔
|
联系
|
订阅
|
管理
上一页
1
···
9
10
11
12
13
14
15
16
17
···
23
下一页
2014年8月6日
单例模式
摘要: 由于项目中用到了一些设计模式,所以稍微总结一下。第一个是单例模式。单例模式分为饿汉模式和懒汉模式:前者是线程安全的后者是非线程安全的。饿汉模式下,是利用静态变量的生命周期以及初始化的特性来实现的。懒汉模式是在使用的时候才初始化。但是不是线程安全的,所以需要加锁来同步。但是直接加锁的话每次都得判断,影...
阅读全文
posted @ 2014-08-06 23:29 canexjtuzju
阅读(148)
评论(0)
推荐(0)
编辑
九章算法--分配抄书员
摘要: 思路:(1)最常见的思路就是dp:状态表示为dp[i][j],表示前j个人抄i本书最少时间;dp[i][j] = min(max(dp[k][j-1],sum(k+1,i))) (j 2 #include 3 #include 4 #include 5 #include 6 #include...
阅读全文
posted @ 2014-08-06 15:00 canexjtuzju
阅读(859)
评论(0)
推荐(0)
编辑
Ubuntu12.04 enable the 'partner' repository
摘要: http://askubuntu.com/questions/14629/how-do-i-enable-the-partner-repositoryGUI Way:Click on the ubuntu button, then search for "Software Sources" and ...
阅读全文
posted @ 2014-08-06 11:05 canexjtuzju
阅读(185)
评论(0)
推荐(0)
编辑
sudo: /etc/sudoers is mode 0777, should be 0440问题解决方案
摘要: 网上有介绍登入root用户,或者去grub的recovery mode选项去选择root模式进入,再去用chmod把/etc/sudoers的权限改回来.但是你可能从来没设置过root密码,或者你根本就不知道root密码是多少.或者即便进入了recovery mode选项去选择root模式,当执行c...
阅读全文
posted @ 2014-08-06 10:44 canexjtuzju
阅读(538)
评论(0)
推荐(0)
编辑
2014年8月4日
LeetCode--Minimum Window Substring
摘要: 这题关键注意:T可能有重复,所以得统计次数,我之前理解错了,后来参考别人代码才知道的。思路就是双指针+字符hash,具体见注释 1 class Solution { 2 public: 3 string minWindow(string S, string T) { 4 ...
阅读全文
posted @ 2014-08-04 10:26 canexjtuzju
阅读(165)
评论(0)
推荐(0)
编辑
2014年8月3日
LeetCode--Combination Sum II
摘要: 思路:类似于上一题,但是加了一个index数组记录结果里面已经存放的元素索引,用来判断当前的元素是否和上一个相同并且上一个是否使用过。主要为了解决重复解的问题。 1 class Solution { 2 public: 3 vector >ans; 4 vector > combin...
阅读全文
posted @ 2014-08-03 21:06 canexjtuzju
阅读(150)
评论(0)
推荐(0)
编辑
LeetCode--Combination Sum
摘要: 题目链接:https://oj.leetcode.com/problems/combination-sum/思路:题目要求合并的答案需要升序排序。所以先排序,然后每次选一个,递归处理。注意:每个元素可以多次,然后不能有重复的答案,所以碰到处理过的元素就不处理了。 1 class Solution {...
阅读全文
posted @ 2014-08-03 16:42 canexjtuzju
阅读(155)
评论(0)
推荐(0)
编辑
2014年8月2日
c++笔记--关于箭头运算符重载使用
摘要: 在stl里面,list的迭代器有重载箭头运算符。之前没搞清楚这个有什么用,看了一些资料,加上自己前面一篇笔记。写了下面测试程序: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8...
阅读全文
posted @ 2014-08-02 20:50 canexjtuzju
阅读(336)
评论(0)
推荐(0)
编辑
程序员面试100题--02
摘要: 题目描述:实现一个min操作位O(1)的栈//之前其实写过一次,这次换一个何海涛的方法,设定辅助栈保存当前的最小值的索引。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #i...
阅读全文
posted @ 2014-08-02 20:44 canexjtuzju
阅读(213)
评论(0)
推荐(0)
编辑
程序员面试100题--01
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 9 /*10 思路:11 递归的转化左子树以及右子树,然后将当前节点作为左子树链表的末尾节点,12 作...
阅读全文
posted @ 2014-08-02 18:59 canexjtuzju
阅读(176)
评论(0)
推荐(0)
编辑
上一页
1
···
9
10
11
12
13
14
15
16
17
···
23
下一页