【题目】
Given a list, rotate the list to the right by k places, where k is non-negative.
For example:
Given 1->2->3->4->5->NULL and k = 2,
return 4->5->1->2->3->NULL.
【题意】
给定一个链表L,和非负数K,要求把链表的后k个节点移到链表前
【思路】
先将指针指向指向倒数第K个节点,然后...
分类:
其他好文 时间:
2014-05-25 18:20:06
阅读次数:
252
上得厅堂,下得厨房,写得代码,翻得围墙,欢迎来到睿不可挡的每日一小练!...
分类:
其他好文 时间:
2014-05-25 18:15:21
阅读次数:
262
【题目】
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).
You may assume that the intervals were initially sorted according to their start times.
Example 1:
Given intervals [1,3],[6,9], insert and mer...
分类:
其他好文 时间:
2014-05-25 12:56:43
阅读次数:
271
算法训练 区间k大数查询
时间限制:1.0s 内存限制:256.0MB
问题描述
给定一个序列,每次询问序列中第l个数到第r个数中第K大的数是哪个。
输入格式
第一行包含一个数n,表示序列长度。
第二行包含n个正整数,表示给定的序列。
第三个包含一个正整数m,表示询问个数。
接下来m行,每行三个数l,r,K,表示询问序...
分类:
其他好文 时间:
2014-05-25 12:55:39
阅读次数:
251
gunzip -r hongchangfirst/data
如何递归删除那些剩余的非log结尾的文件?
先列出确认一下:
find hongchangfirst/data -type f ! -name "*.log"
然后真正的删除:
find hongchangfirst/data -type f ! -name "*.log" -exec rm -f {} \;...
分类:
系统相关 时间:
2014-05-25 09:41:05
阅读次数:
694
寻找图中最小连通的路径,图如下:
算法步骤:
1. Sort all the edges in non-decreasing order of their weight.
2. Pick the smallest edge. Check if it forms a cycle with the spanning tree
formed so far. If cycle is n...
分类:
其他好文 时间:
2014-05-25 07:35:59
阅读次数:
301
算法训练 最大最小公倍数
时间限制:1.0s 内存限制:256.0MB
问题描述
已知一个正整数N,问从1~N中任选出三个数,他们的最小公倍数最大可以为多少。
输入格式
输入一个正整数N。
输出格式
输出一个整数,表示你找到的最小公倍数。
样例输入
9
样例输出
504
数据规模与约定
...
分类:
其他好文 时间:
2014-05-25 07:33:56
阅读次数:
243
【题目】
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, 2, 3 ],
[ 8, 9, 4 ],
[ 7, 6, 5 ]
]
【题意】
给定整数n, 将1,2,3...nxn个数按螺旋旋转的方式填入n...
分类:
其他好文 时间:
2014-05-25 07:08:17
阅读次数:
235
【题目】
The set [1,2,3,…,n] contains a total of n! unique permutations.
By listing and labeling all of the permutations in order,
We get the following sequence (ie, for n = 3):
"123"
"132"
"213"
"231"
"312"
"321"
Given n and k, return the kth permutation ...
分类:
其他好文 时间:
2014-05-25 06:13:37
阅读次数:
276
在互联网时代飞速发展的前景下加上昂贵的竞价费用让多数企业苦不堪言于是低成本投入的职业-seo就诞生了,从业人数也每年呈递增状态,然而互联网的垃圾信息也越来越多,于是搜索引擎为了更好的迎合用户体验也频繁的展开了各项算法调整。在这期间当然也有很多网站被降权甚至被K掉,至于什么原因,有很多从职朋友还不能彻底的找到问题的根源,下面笔者以个人多年经验为大家展开一下分享,希望能帮助你早日恢复网站排名。
...
分类:
Web程序 时间:
2014-05-25 04:23:40
阅读次数:
229