qingcheng奕  
1 2 3 4 5 ··· 23 下一页

2014年10月13日

摘要: 有一列数,其中有1个数出现了1次,其它数都出现了3次,求这个数。class Solution {public: int singleNumber(int A[], int n) { if(n > i & 1; q = (q + p ) % 3; ... 阅读全文
posted @ 2014-10-13 10:56 qingcheng奕 阅读(129) 评论(0) 推荐(0) 编辑

2014年9月11日

摘要: import threading, os, subprocess, timeexec_path = "/home/xhz/gems/ruby/amd...../bin/tester.exec"out_data_path = "/home/xhz/...generated/"max_process =... 阅读全文
posted @ 2014-09-11 17:19 qingcheng奕 阅读(730) 评论(0) 推荐(0) 编辑

2014年9月6日

摘要: 在1 - 10 中,求出 7 个数的排列组合。出现了超时,而超时的原因是有好多重复情况,复杂度上来说,和答案的复杂度是一样的,但是答案中重复了太多了,体会下。超时1:class Solution {public: vector > combine(int n, int k) { ... 阅读全文
posted @ 2014-09-06 21:37 qingcheng奕 阅读(158) 评论(0) 推荐(0) 编辑
 
摘要: 判断一个 int 是否为回文的有一点要注意的是:int x;int _x = abs(x);对 x 取绝对值的时候,会发生溢出。比如 x = INT_MIN 即 -2147483648 而 INT_MAX 为2147483647其实,负数不是回文数 阅读全文
posted @ 2014-09-06 20:29 qingcheng奕 阅读(105) 评论(0) 推荐(0) 编辑

2014年9月3日

摘要: 在书的105页使用中根遍历的思想left 之后 为 root 之后 为 right则对左子树来说left->right = root;root->left = left;对右子树来说root->right = right-> -> -> left;left->left 为根的根 的根而right-... 阅读全文
posted @ 2014-09-03 19:36 qingcheng奕 阅读(206) 评论(0) 推荐(0) 编辑

2014年8月22日

摘要: 分别记录从 root 到 node1 的path 到 node2的path,再找其中共同的部分struct Node{ int val; struct Node *left; struct Node *right; Node(int _val) { val... 阅读全文
posted @ 2014-08-22 16:16 qingcheng奕 阅读(182) 评论(0) 推荐(0) 编辑

2014年8月21日

摘要: http://www.cplusplus.com/reference/queue/priority_queue/priority_queue 的top始终保持着为一堆数据中的最大元素。读取最小 O(1)插入和删除 lg(n)(真是又简便又好用,难怪g不要我,当时连这个都不会写,sigh...)#in... 阅读全文
posted @ 2014-08-21 10:52 qingcheng奕 阅读(237) 评论(1) 推荐(0) 编辑
 
摘要: 在C++中,虽然堆不像 vector, set 之类的有已经实现的数据结构,但是在 algorithm.h 中实现了一些相关的模板函数。下面是一些示例应用http://www.cplusplus.com/reference/algorithm/pop_heap/#include #include ... 阅读全文
posted @ 2014-08-21 09:58 qingcheng奕 阅读(8492) 评论(0) 推荐(1) 编辑

2014年8月20日

摘要: http://igoro.com/archive/what-really-happens-when-you-navigate-to-a-url/http://www.cnblogs.com/panxueji/archive/2013/05/12/3073924.html作为一个软件开发者,你一定会对... 阅读全文
posted @ 2014-08-20 11:38 qingcheng奕 阅读(228) 评论(0) 推荐(1) 编辑

2014年8月19日

摘要: 第三种方法为位运算的方法。位运算符: #include #include #include #include using namespace std;//时间 O(n) 空间 O(1)bool hasSame(string str){ if(str.size() == 0 ) r... 阅读全文
posted @ 2014-08-19 11:26 qingcheng奕 阅读(240) 评论(0) 推荐(0) 编辑
1 2 3 4 5 ··· 23 下一页