摘要: 打印list的时候unicode对象不会自动转为中文! 阅读全文
posted @ 2016-04-27 21:30 向日葵的祈愿 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 最近面试的时候被问到一个问题是,在C++中,能否在类的成员函数中调用delete this,后来网上查了一下资料,关于这个问题说得比较好的有http://blog.sina.com.cn/s/blog_4b4cf2af0100ywgv.html 但是自己尝试了一下,还是有点区别的。 我写了如下代码: 阅读全文
posted @ 2016-04-12 10:11 向日葵的祈愿 阅读(5403) 评论(0) 推荐(3) 编辑
摘要: 查看网站日志 sudo journalctl -u uwsgi@xxxxx.com 或者进入/etc/uwsgi/xxx.com.ini 看日志logto到哪里 取消文件权限 chown username:username xxx.log 阅读全文
posted @ 2016-03-26 20:10 向日葵的祈愿 阅读(260) 评论(0) 推荐(0) 编辑
摘要: https://github.com/shiyanhui/FileHeader 修改的模板在这个路径下:C:\Users\【USERNAME】\AppData\Roaming\Sublime Text 2\Packages\FileHeader\template\header 阅读全文
posted @ 2016-03-12 18:03 向日葵的祈愿 阅读(3882) 评论(0) 推荐(1) 编辑
摘要: /* Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100 */ class Solution { public: string add 阅读全文
posted @ 2016-03-10 11:42 向日葵的祈愿 阅读(356) 评论(0) 推荐(0) 编辑
摘要: 摘自:《啊哈算法》 我们要用1, 2, 5, 12, 7, 17, 25, 19, 36, 99, 22, 28, 46, 92来建立最小堆,并且删除最小的数,并增加一个数23 如何建立这个堆: //建堆 n = 0; for (int i = 1; i <= m; i++) { n++; h[n] 阅读全文
posted @ 2016-03-10 10:10 向日葵的祈愿 阅读(36963) 评论(0) 推荐(3) 编辑
摘要: 筛法计算素数: class Solution { public: int countPrimes(int n) { vector<bool> isprime(n, true); isprime[0] = false; isprime[1] = false; for (int i = 2; i < s 阅读全文
posted @ 2016-03-10 00:55 向日葵的祈愿 阅读(217) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list in O(n log n) time using constant space complexity. 链表的归并排序。 /** * Definition for singly-linked list. * struct ListNode { * int val 阅读全文
posted @ 2016-03-08 23:51 向日葵的祈愿 阅读(198) 评论(0) 推荐(0) 编辑
摘要: Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: A: a1 → a2 阅读全文
posted @ 2016-03-08 00:28 向日葵的祈愿 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 题目描述: /*Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two e 阅读全文
posted @ 2016-03-03 00:40 向日葵的祈愿 阅读(241) 评论(0) 推荐(0) 编辑