摘要: 很偷懒地表示,说好要认真写写解题思路,结果。。习惯还没养成就放弃了面了几面发现自己的语言表达能力实在拙计,所以重新开始写写解题思路。。。实在是一大短板,没法表达清楚,很多知道的东西讲不出来,给面试官的感觉很糟糕吧。。。 阅读全文
posted @ 2014-08-26 17:14 Sara Chi 阅读(105) 评论(0) 推荐(0) 编辑
摘要: //方案一: O(N)? 不适合海量数据int* maxK(int A[] , const int& n, const int& k){ if(np) --end; if(begin>=end) return begin; swap(A[begin],A[end]); ... 阅读全文
posted @ 2014-07-22 17:04 Sara Chi 阅读(116) 评论(0) 推荐(0) 编辑
摘要: char a[] = "hello";string s = "hello";cout<<sizeof(a)<<endl;cout<<sizeof(s)<<endl;cout<<sizeof(s.c_str())<<endl; 输出为6324最后一个c_str返回的是char*,所有指针的长度都为4... 阅读全文
posted @ 2014-06-06 16:09 Sara Chi 阅读(349) 评论(0) 推荐(0) 编辑
摘要: 算术类型:整型(integral type)char : 一个机器字节(1BYTE = 8BIT)bool: 1 BIT整型: int: 与编译环境相关(不是机器),32位的编辑环境则长度为32BIT,故可以使用sizeof(int)来得到编译器环境的位数(返回的是字节长度)short/long/... 阅读全文
posted @ 2014-06-06 15:44 Sara Chi 阅读(129) 评论(0) 推荐(0) 编辑
摘要: cout:标准输出,输出到缓冲区中,需要使用endl(将缓冲区内容刷新到设备中,并换行) 可以被重定向输出到文件中。cerr:标准错误流,直接输出到显示屏,无缓冲clog: 标准错误流,输入到缓冲区重定向到文件的方法:1. 编译运行时重定向test.exe>>test.txt;2.int a = ... 阅读全文
posted @ 2014-06-06 14:51 Sara Chi 阅读(457) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list using insertion sort./** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNo... 阅读全文
posted @ 2014-06-04 10:05 Sara Chi 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list inO(nlogn) time using constant space complexity./** * Definition for singly-linked list. * struct ListNode { * int val; * L... 阅读全文
posted @ 2014-06-03 16:37 Sara Chi 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line./** * Definition for a point. * struct Point { * ... 阅读全文
posted @ 2014-06-03 11:38 Sara Chi 阅读(174) 评论(0) 推荐(0) 编辑
摘要: Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another express... 阅读全文
posted @ 2014-05-21 23:48 Sara Chi 阅读(122) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note... 阅读全文
posted @ 2014-05-21 23:18 Sara Chi 阅读(106) 评论(0) 推荐(0) 编辑