Given an array of non-negative integers, you
are initially positioned at the first index of the array.Each element in the
array represents your maximu...
分类:
其他好文 时间:
2014-05-26 18:46:20
阅读次数:
251
【题目】
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Determine if you are able to reach the last index.
For example:...
分类:
其他好文 时间:
2014-05-24 20:44:39
阅读次数:
221
之所以说leetcode的测试用例有问题,是因为我刚开始理解错了题意,写下了如下的错误的代码。但是却AC了。
错误代码为:
bool canJump(int A[], int n) {
if(n == 0) return true;
int sum = 0; //记录当前的最远距离
int i = 0;
...
分类:
其他好文 时间:
2014-05-24 19:45:57
阅读次数:
1081
//滚动到指定元素的id处 如:$("#Exam82") function Jump() { var
scroll_offset = $("#Exam82").offset(); //得到Exam82这个div层的offset,包含两个值,top和left
$("body,html").an...
分类:
其他好文 时间:
2014-05-24 01:56:28
阅读次数:
410
【题目】
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Your goal is to reach the last index in the minimum number of ju...
分类:
其他好文 时间:
2014-05-22 17:02:20
阅读次数:
244
Given an array of non-negative integers, you
are initially positioned at the first index of the array.Each element in the
array represents your maximu...
分类:
其他好文 时间:
2014-05-21 04:39:53
阅读次数:
332
5道题目分别是:【Largest Rectangle in Histogram】、【Minimum Path Sum】、【Jump Game】、【Jump Game II 】、【Valid Number】,由于有一些题目不需要发一整篇博文来记录,所以就将这些题目以一篇博文5道来记录。...
分类:
其他好文 时间:
2014-05-21 03:05:33
阅读次数:
481
Jump Game IGiven an array of non-negative
integers, you are initially positioned at the first index of the array.Each
element in the array represents ...
分类:
其他好文 时间:
2014-05-19 15:16:57
阅读次数:
373
题目连接:Codeforces 432D Prefixes and Suffixes
题目大意:给出一个字符串,求所有既是前缀串又是后缀串的字符串出现了几次。
解题思路:根据性质可以根据KMP算法求出所有的前后缀串,然后利用dp求解,dp[i]表示从1到i这个子串出现过的次数。转移方程dp[jump[i]]+=dp[i]。任意一个dp[i]的初始状态应该是1。
#include
#...
分类:
其他好文 时间:
2014-05-18 14:11:46
阅读次数:
321