class Solution {public: bool canJump(int A[], int n) { if (A == NULL || n sum(n, 0); int jump = A[n-1]; for (int i=n-...
分类:
其他好文 时间:
2014-07-17 00:01:54
阅读次数:
292
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.下面是百度得到的关于罗马数的解释:我的代码: 1 class Solution { 2 ...
分类:
其他好文 时间:
2014-07-16 18:00:22
阅读次数:
214
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.
For example,
If n = 4 and k = 2, a solution is:
[
[2,4],
[3,4],
[2,3],
[1,2],
[1,3],
[1,4],
]...
分类:
其他好文 时间:
2014-07-16 17:27:32
阅读次数:
139
问题的思路是这样:
循环取头部合并,其实也可以换个角度来看,就是将后面的链表结点,一次隔空插入到第一部分的链表中。
class Solution:
# @param head, a ListNode
# @return nothing
def reorderList(self, head):
if None == head or None == ...
分类:
编程语言 时间:
2014-07-16 17:23:30
阅读次数:
207
题目分析见这里
class Solution:
# @param head, a ListNode
# @return a list node
def detectCycle(self, head):
if None == head or None == head.next:
return None
pfast = ...
分类:
编程语言 时间:
2014-07-16 17:18:53
阅读次数:
248
class Solution {public: string countAndSay(int n) { vector num; num2digit(1, num); vector tmp; for (int i = 1; i &digit...
分类:
其他好文 时间:
2014-07-16 17:02:13
阅读次数:
144
当今很多公司做的产品只是全球化工作的一部分,而如何处理本地jenkins自动触发异地jenkins的配置,却成为了一个问题。本文提出了2种简单的解决方案。...
分类:
其他好文 时间:
2014-07-16 12:47:05
阅读次数:
190
class Solution {private: int queen_num; vector > res;public: vector > solveNQueens(int n) { res.clear(); queen_num = n; ...
分类:
其他好文 时间:
2014-07-16 12:09:34
阅读次数:
247
class Solution:
# @param head, a ListNode
# @return a boolean
def hasCycle(self, head):
if None == head or None == head.next:
return False
pfast = head
...
分类:
编程语言 时间:
2014-07-16 09:50:21
阅读次数:
271