The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations:
d1 is
the distance between the 1-st and the 2-nd
station;
d2 is
the d...
分类:
其他好文 时间:
2014-07-22 23:05:14
阅读次数:
302
表
a = { }
b = { x = 1, ["hello, "] = "world!" }
a.astring = "ni, hao!"
a[1] = 100
a["a table"] = b
function foo()
end
function bar()
end
a[foo] = bar
--分别穷举表a和b
for k, v in pairs(a) do
print(k, "=>",...
分类:
其他好文 时间:
2014-07-22 23:00:33
阅读次数:
261
internal class CacheHelper { /// /// Insert
value into the cache using /// appropriate name/value pairs /// //...
分类:
其他好文 时间:
2014-05-09 04:19:56
阅读次数:
246
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
For example, given n = 3, a solution set is:
"((()))", "(()())", "(())()", "()(())", "()()...
分类:
其他好文 时间:
2014-05-09 02:29:07
阅读次数:
302
Link:http://oj.leetcode.com/problems/swap-nodes-in-pairs/Given a linked list,
swap every two adjacent nodes and return its head.For example,Given1->2-...
分类:
其他好文 时间:
2014-05-05 22:45:37
阅读次数:
331
DescriptionThe inversion number of a given
number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i
aj.For a given sequence of ....
分类:
其他好文 时间:
2014-05-05 11:42:13
阅读次数:
276
原题地址:http://oj.leetcode.com/problems/swap-nodes-in-pairs/题意:将链表中的节点两两交换。Given1->2->3->4,
you should return the list as2->1->4->3.解题思路:这题主要涉及到链表的操作,没什么...
分类:
编程语言 时间:
2014-05-01 06:44:21
阅读次数:
339
2014-04-29
00:04题目:给定一个整数数组,找出所有加起来为指定和的数对。解法1:可以用哈希表保存数组元素,做到O(n)时间的算法。代码: 1 // 17.12
Given an array of integers and target value, find all pairs in ...
分类:
其他好文 时间:
2014-04-29 15:08:13
阅读次数:
469