Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephon...
分类:
其他好文 时间:
2014-06-25 12:09:43
阅读次数:
184
/** * 返回數組某個值的下標 * */Array.prototype.position = function(val){ for(var i in this){ if(this[i]==val){ return i; bre...
分类:
编程语言 时间:
2014-06-25 11:51:27
阅读次数:
382
Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o...
分类:
其他好文 时间:
2014-06-25 11:10:16
阅读次数:
163
函数定义使用 func 定义一个函数。调用函数使用他的名字加 上小括号中的参数列表。使用 -> 分隔参数的名字和 返回值类型。函数声明:[html]view plaincopyfuncgreet(name:String,day:String)->String{return"Hello\(name),...
分类:
其他好文 时间:
2014-06-25 11:03:16
阅读次数:
269
函数定义 使用 func 定义一个函数。调用函数使用他的名字加 上小括号中的参数列表。使用 -> 分隔参数的名字和 返回值类型。 函数声明: func greet(name: String, day: String) -> String {
return "Hello \(name),today is \(day)."
} 函数调用:greet("Bob", "Tuesday") 无返回值函数...
分类:
其他好文 时间:
2014-06-25 10:04:23
阅读次数:
255
语法: { (parameters) ->return type in statements} 实例:采用函数实现: let names =["Chris", "Alex", "Ewa", "Barry", "Daniella"]
funcbackwards(s1: String, s2: String) -> Bool {
return s1 > s2
}
var reversed = sort...
分类:
其他好文 时间:
2014-06-25 10:01:29
阅读次数:
224
Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephon...
分类:
其他好文 时间:
2014-06-25 09:15:12
阅读次数:
362
在计算最短路径之前,往往会先计算最短路径树,也就是计算从一个顶点出发,到其余所有顶点的最短距离。
有了最短路径树之后,路径和距离就非常容易实现了:
public double distTo(int v) {
return distTo[v];
}
public Iterable pathTo(int v) {
Stack result = new Sta...
分类:
其他好文 时间:
2014-06-25 08:16:29
阅读次数:
246
【题目】
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
For example,
Given [100, 4, 200, 1, 3, 2],
The longest consecutive elements sequence is [1, 2, 3, 4]. Return its length: 4.
Your algorithm should run...
分类:
其他好文 时间:
2014-06-25 07:55:42
阅读次数:
244
#include
#include
#include
#include
#include
int main( void )
{
daemon_init();
fprintf(stderr, "main进程[%d]\n", getpid() );
while( 1 )
{
}
exit(0);
}
i...
分类:
其他好文 时间:
2014-06-25 07:07:43
阅读次数:
204