摘要: 今天做错了一道笔试题,发现以前的对于Java引用理解有误,特撰文记录题目如下:public class Tester{public static void main(String[] args){ Integer var1=new Integer(1); Integer var2=var1;... 阅读全文
posted @ 2015-07-04 16:29 Gavin.Lin 阅读(2202) 评论(0) 推荐(2) 编辑
摘要: 题目:Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use onl... 阅读全文
posted @ 2015-05-04 12:37 Gavin.Lin 阅读(405) 评论(0) 推荐(0) 编辑
摘要: 首先确保已经安装有MySql的开发包ubuntu下执行如下命令安装,其他发行版请自行查阅apt-get install libmysqlclient-dev范例代码如下:#include #include #include #include using namespace std;int main(... 阅读全文
posted @ 2015-05-01 18:31 Gavin.Lin 阅读(1904) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exa... 阅读全文
posted @ 2015-04-20 12:00 Gavin.Lin 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 题目描述:Given a range [m, n] where 0 >= 1; } return res;} 阅读全文
posted @ 2015-04-19 21:44 Gavin.Lin 阅读(113) 评论(0) 推荐(0) 编辑
摘要: vector vec;vec[0];vec.at(0);vec是个空集合的情况下,[]访问是行为未定义的,at访问则会抛出std::out_of_range异常。c++标准不要求vector::operator[]进行下标越界检查,原因是为了效率,总是强制下标越界检查会增加程序的性能开销。设计vec... 阅读全文
posted @ 2015-04-02 18:09 Gavin.Lin 阅读(1561) 评论(0) 推荐(0) 编辑
摘要: 系统调用selectpollepoll函数原型int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, struct timeval* timeout)int poll(struct pollfd* fds,... 阅读全文
posted @ 2015-03-31 21:32 Gavin.Lin 阅读(633) 评论(0) 推荐(0) 编辑
摘要: 作者:July时间:最初写于2011年12月,2014年7月21日晚10点 全部删除重写成此文,随后的半个多月不断反复改进。原文链接:从头到尾彻底理解KMP1. 引言 本KMP原文最初写于2年多前的2011年12月,因当时初次接触KMP,思路混乱导致写也写得混乱。所以一直想找机会重新写下KMP,但... 阅读全文
posted @ 2015-03-25 21:41 Gavin.Lin 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 在非HA模式下,只须如下代码就可以轻松实现上传文件,标红的这句是关键public class CopyToHDFS { public static void main(String[] args) throws IOException { Configurati... 阅读全文
posted @ 2015-03-11 11:12 Gavin.Lin 阅读(3843) 评论(0) 推荐(0) 编辑