https://oj.leetcode.com/problems/linked-list-cycle/http://blog.csdn.net/linhuanmars/article/details/21200601/**
*Definitionforsingly-linkedlist.
*classListNode{
*intval;
*ListNodenext;
*ListNode(intx){
*val=x;
*next=null;
*}
*}
*/
publicclassSolution{
publi..
分类:
其他好文 时间:
2015-01-09 01:52:33
阅读次数:
155
https://oj.leetcode.com/problems/binary-tree-preorder-traversal/http://blog.csdn.net/linhuanmars/article/details/21428647/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){val=x;}
*}
*/
publicclassSolu..
分类:
其他好文 时间:
2015-01-09 01:52:30
阅读次数:
274
https://oj.leetcode.com/problems/reorder-list/http://blog.csdn.net/linhuanmars/article/details/21503215/**
*Definitionforsingly-linkedlist.
*classListNode{
*intval;
*ListNodenext;
*ListNode(intx){
*val=x;
*next=null;
*}
*}
*/
publicclassSolution{
publicvoid..
分类:
其他好文 时间:
2015-01-09 01:51:44
阅读次数:
175
https://oj.leetcode.com/problems/linked-list-cycle-ii/http://blog.csdn.net/linhuanmars/article/details/21260943/**
*Definitionforsingly-linkedlist.
*classListNode{
*intval;
*ListNodenext;
*ListNode(intx){
*val=x;
*next=null;
*}
*}
*/
publicclassSolution{
pu..
分类:
其他好文 时间:
2015-01-09 01:51:33
阅读次数:
173
https://oj.leetcode.com/problems/insertion-sort-list/http://blog.csdn.net/linhuanmars/article/details/21144553/**
*Definitionforsingly-linkedlist.
*publicclassListNode{
*intval;
*ListNodenext;
*ListNode(intx){
*val=x;
*next=null;
*}
*}
*/
publicclassSolutio..
分类:
其他好文 时间:
2015-01-09 01:50:04
阅读次数:
172
https://oj.leetcode.com/problems/lru-cache/http://blog.csdn.net/linhuanmars/article/details/21310633publicclassLRUCache{
publicLRUCache(intcapacity){
map=newHashMap<>();
head=null;
tail=null;
this.size=0;
this.capacity=capacity;
}
publicintget(intke..
分类:
系统相关 时间:
2015-01-09 01:49:29
阅读次数:
220
https://oj.leetcode.com/problems/candy/http://blog.csdn.net/linhuanmars/article/details/21424783publicclassSolution{
publicintcandy(int[]ratings){
//从左边向右边遍历
//如果这个比前一个大,++
//否则持平
//这样保证左右小孩和他右边的人比较是合法的
//
//同理向..
分类:
其他好文 时间:
2015-01-08 18:16:42
阅读次数:
155
https://oj.leetcode.com/problems/single-number/http://blog.csdn.net/linhuanmars/article/details/22648829publicclassSolution{
publicintsingleNumber(int[]A)
{
//SolutionA
//returnsingleNum_Xor(A);
//SolutionB
returnsingleNum_BitCompare(A);
//SolutionC
//ret..
分类:
其他好文 时间:
2015-01-08 18:16:14
阅读次数:
141
https://oj.leetcode.com/problems/single-number-ii/http://blog.csdn.net/linhuanmars/article/details/22645599publicclassSolution{
publicintsingleNumber(int[]A){
returnsingleNumber_BitCompare(A,3);
}
privateintsingleNumber_BitCompare(int[]A,intk)
{
inttoRetur..
分类:
其他好文 时间:
2015-01-08 18:15:42
阅读次数:
200
https://oj.leetcode.com/problems/copy-list-with-random-pointer/http://blog.csdn.net/linhuanmars/article/details/22463599/**
*Definitionforsingly-linkedlistwitharandompointer.
*classRandomListNode{
*intlabel;
*RandomListNodenext,random;
*RandomListNode(intx)..
分类:
其他好文 时间:
2015-01-08 18:15:38
阅读次数:
106