由买买提看人间百态

topics

全部话题 - 话题: jumped
首页 上页 1 2 3 4 5 6 7 8 9 10 (共10页)
c***2
发帖数: 838
1
来自主题: JobHunting版 - How to jump to Program Counter (PC)
Write C codes to jump to the given PC.
s******n
发帖数: 3946
2
题目要求不一样? 一个要求判断能否走到最后一步,这个是走到最后一步的最少jump
p*****2
发帖数: 21240
3


题目要求不一样? 一个要求判断能否走到最后一步,这个是走到最后一步的最少jump
★ Sent from iPhone App: iReader Mitbbs Lite 7.51
s******e
发帖数: 108
4
a more concise version
public static int jump (int [] A) {
int jumpcount =0;
int startPos =0;
int max = 0;
int newmax = 0;
while(max jumpcount++;
for(int i=startPos; i<=max;i++){
newmax = Math.max(newmax, A[i]+i);
}
startPos = max+1;
... 阅读全帖
C*******n
发帖数: 49
5
Think like this: if A[i] = x, then A[i] has an edge (with weight all equal
to 1) to all A[i+1...i+x].
Then the problem is just a BFS to count the shortest path from A[0] to A[n-
1].

public int jump(int[] A) {
int count = 0;
int start=0, end=0, newend;
while (end < A.length-1){
count++;
newend = 0;
for (int i=start; i<=end; i++)
newend = i+A[i]>newend ? (i+A[i]) : newend;
start = end+1;
en... 阅读全帖
C***U
发帖数: 2406
6
你这个想法不错!!
jump game 1和2都能用这个办法解决 都变成tree transverse了
用bfs就可以了吧
而且是O(n)时间的
s******n
发帖数: 3946
7
题目要求不一样? 一个要求判断能否走到最后一步,这个是走到最后一步的最少jump
p*****2
发帖数: 21240
8


题目要求不一样? 一个要求判断能否走到最后一步,这个是走到最后一步的最少jump
★ Sent from iPhone App: iReader Mitbbs Lite 7.51
s******e
发帖数: 108
9
a more concise version
public static int jump (int [] A) {
int jumpcount =0;
int startPos =0;
int max = 0;
int newmax = 0;
while(max jumpcount++;
for(int i=startPos; i<=max;i++){
newmax = Math.max(newmax, A[i]+i);
}
startPos = max+1;
... 阅读全帖
C*******n
发帖数: 49
10
Think like this: if A[i] = x, then A[i] has an edge (with weight all equal
to 1) to all A[i+1...i+x].
Then the problem is just a BFS to count the shortest path from A[0] to A[n-
1].

public int jump(int[] A) {
int count = 0;
int start=0, end=0, newend;
while (end < A.length-1){
count++;
newend = 0;
for (int i=start; i<=end; i++)
newend = i+A[i]>newend ? (i+A[i]) : newend;
start = end+1;
en... 阅读全帖
C***U
发帖数: 2406
11
你这个想法不错!!
jump game 1和2都能用这个办法解决 都变成tree transverse了
用bfs就可以了吧
而且是O(n)时间的
l****o
发帖数: 315
12
public class Solution {
public int jump(int[] A) {
// Start typing your Java solution below
// DO NOT write main() function
int curMax = 0; int nextMax = 0; int ans = 0;
for (int i = 0; i < A.length; i++) {
if (i <= curMax) {
if (A[i] + i > nextMax)
nextMax = A[i] + i;
} else {
curMax = nextMax;
ans++;
i--;
}
}
return a... 阅读全帖
l*******b
发帖数: 2586
13
int jump(int A[], int n) {
int p = 0, q = 0, i = 0;
while(q < n-1) {
int m = q;
for(; p <= q; ++p)
m = max(m, p + A[p]);
if(m == q) return -1; // in case cannot reach end
q = m;
++i;
}
return i;
}
挺好做得这个,哈哈
q***y
发帖数: 236
14
我的dp方法。过了online judge。请大家帮忙看看复杂度多少?
int jump(int A[], int n) {
vector steps(n);
steps[n-1] = 0;
for (int i=n-2; i>=0; --i) {
if (A[i]==0) steps[i] = -1; // unable to reach
else if (A[i]>=n-i-1) steps[i] = 1;
else {
int msp = n-i-1;
for (int j=A[i]; j>0; --j) {
if (steps[i+j]>-1 && steps[i+j] if (msp==1) break;
}
steps[i] = msp+1;
}
}
retu... 阅读全帖
S****h
发帖数: 115
15
嗯,看来greedy确实是最优解法O(n),贴个code:
public int jump(int[] A) {
int jumpCount = 0;
int index = 0;
int limit = 0;
while (limit < A.length - 1) {
jumpCount++;
int temp = limit;
for (int i = index; i <= limit; i++) {
if (A[i] + i > temp)
temp = A[i] + i;
}
// can not progress
if (limit == temp)
return -1;
// progress
index = limit + 1;
limit = temp;
... 阅读全帖
g**x
发帖数: 373
h*****f
发帖数: 248
17
【 以下文字转载自 Quant 讨论区 】
发信人: backollie (Ollie), 信区: Quant
标 题: 有朋友做过C++的assessment 吗?Jump Trading
发信站: BBS 未名空间站 (Tue Feb 21 10:31:08 2012, 美东)
能分享一下大概是什么样的题吗?谢谢!!!
l*******b
发帖数: 2586
18
来自主题: JobHunting版 - leetcode jump game2
int jump(int A[], int n) {
int p = 0, q = 0, i = 0;
while(q < n-1) {
int m = q;
for(; p <= q; ++p)
m = max(m, p + A[p]);
if(m == q) return -1; // in case cannot reach end
q = m;
++i;
}
return i;
}
j*****y
发帖数: 1071
19
来自主题: JobHunting版 - leetcode jump game2
BFS 的复杂度是 O(V + E)
jump game 里面的 E 差不多是 V^2 , 所以 BFS的复杂度应该是 O(n^2)
w****a
发帖数: 710
20
来自主题: JobHunting版 - leetcode jump game2
用greedy能O(n),用DP达不到O(n)
研究了三种DP的办法,有一种能四十多毫秒过大集合,有一种超时,一种要一千多毫秒
greedy的解jump game是最好的
h**u
发帖数: 35
21
来自主题: JobHunting版 - leetcode jump game2
BFS is OK, but traverse from the farthest kid first when visiting a node
class Solution {
public:
int jump(int A[], int n)
{
if ( !A || n <=1)
return 0;
queue Q;
vector min_jump(n, -1);
Q.push(0);
min_jump[0] = 0;
while (!Q.empty()) {

int cur = Q.front();
Q.pop();
if ( A[cur] + cur >= n - 1)
return min_jump[cur] + 1;
for (int i=A[cur]; i... 阅读全帖
s****0
发帖数: 117
22
来自主题: JobHunting版 - leetcode jump game2
先贴我的,再看大家的。
public class Solution {
public int jump(int[] jmp) {
int n = jmp.length;
int canReach[] = new int[n];
for (int i = 1; i < n; i++) {
canReach[i] = Integer.MAX_VALUE;
}
canReach[0] = 0;
int head = 0;
for (int i = 0; i < n; i++) {
if (canReach[i] > n)
continue;
for (int j = Math.max(i, head) + 1; (j <= i + jmp[i]) && (j < n)
; j++) {
canReach[j] = Math.min(canR... 阅读全帖
B********t
发帖数: 147
23
来自主题: JobHunting版 - jump game II原来可以这样做
搞了半天DP,还是通不过大集合。原来就这么几行就解决了
int jump(int A[], int n) {
int hops = 0;
int end = n-1;
while(end)
{
for(int i = 0; i <= end; i++)
{
if((A[i]+i)>=end)
{
hops++;
end = i;
}
}
}
return hops;
}
这算是greedy吗?不熟悉greedy。准备去看看算法导论上的那章。
c********t
发帖数: 5706
24
根据数组左右jump,最后判断能不能到0点
求原题!
记得二爷好像在哪里总结过。
c****7
发帖数: 4192
25
来自主题: JobHunting版 - jump game II solved in 1 loop(Q(n))
public class Solution {
public int jump(int[] A) {
int i=A.length-1;
int step=0;
while(i>0){
for(int j=0;j if(A[j]+j>=i){
step++;
i=j;
break;
}
}
}
return step;
}
}
c****7
发帖数: 4192
26
来自主题: JobHunting版 - jump game II solved in 1 loop(Q(n))
没有给你test。python不会。呵呵。
这是我理解的从前往后dp,大数据最后一个超时:
public int jump(int[] A) {
int[]dp=new int[A.length];
for(int i=1;i for(int j=0;j if(A[j]>=i-j&&(dp[i]==0||dp[i]>dp[j]+1)){
dp[i]=dp[j]+1;
}
}
}
return dp[A.length-1];
}
也许和你的不一样吧?

1):
c****7
发帖数: 4192
27
来自主题: JobHunting版 - jump game II的证明
我这样是greedy吗?
public int jump(int[] A) {
int i=A.length-1;
int step=0;
while(i>0){
for(int j=0;j if(A[j]+j>=i){
step++;
i=j;
break;
}
}
}
return step;
}
从最后一个开始,看从最前面哪一个可以跳到最后,找到就break,算一步。再从前往
后找,找到第一个就break,算第2步,直到第一个。我这个greedy是从后往前,好像没
有逻辑错误呀。

then
in
s
c****7
发帖数: 4192
28
来自主题: JobHunting版 - jump game II的证明
用我这个算法:
public int jump(int[] A) {
int i=A.length-1;
int step=0;
while(i>0){
for(int j=0;j if(A[j]+j>=i){
step++;
i=j;
break;
}
}
}
return step;
}
i=6 step=0;
i=3 step=1;
i=1 step=2;
i=0 step=3;
每次greedy最小的能到当前节点的节点。空间1,时间最坏是O(n^2),最好是O(1)
c******a
发帖数: 789
29
来自主题: JobHunting版 - 请教一下jump game
I就不用找答案了吧。
II我看这个挺好http://fisherlei.blogspot.com/2012/12/leetcode-jump-ii.html
楼主其实你可以自己google一下的。。。。
l*******t
发帖数: 79
30
来自主题: JobHunting版 - leetcode jump game 用一维DP做
之前用二维dp能过oj, 这次做貌似就超时了。。
查了一下可以用一维dp来搞(http://fisherlei.blogspot.com/2012/12/leetcode-jump-game.html)。。。看完答案觉得挺合理的,但是要是自己想的话怎么能直接想到用一维的来做呢?因为感觉写二维递推式是最直观的。。。DP这个思维总是建立不起来啊,求各位高人指点!
b**********5
发帖数: 7881
31
来自主题: JobHunting版 - FB jumps
不觉得stock jump了, 就要hire了。 FB过去几年, hire了这么多人, 也要消化消
化。。再说了
, hire了这么多人, 也会有diminish return,。。。
w********s
发帖数: 1570
32
来自主题: JobHunting版 - Baidu USA还是Jump Trading?
国内没人知道jump吧
j******o
发帖数: 1788
33
来自主题: JobHunting版 - Baidu USA还是Jump Trading?
HFT is dying, unless you get pnl cut in Jump, not recommend for 码工

发帖数: 1
34
来自主题: JobHunting版 - Baidu USA还是Jump Trading?
GetGo和jump这种algo shop比较注重名校出身,还是比百度难进吧?如果offer能match
而且楼主,长期应该会更有回报率
l***e
发帖数: 108
35
来自主题: JobHunting版 - Baidu USA还是Jump Trading?
国内没有HFT。国内做金融不知道jump的多了去了。。
t*******t
发帖数: 301
36
RealtyTrac Inc. said Thursday that the number of U.S. homes taken over by
banks jumped 35 percent in the
first quarter from a year ago. In addition, households facing foreclosure
grew 16 percent in the same period
and 7 percent from the last three months of 2009.
One in every 33 homes in Nevada was facing foreclosure, more than four times
the national average,
RealtyTrac said.
Foreclosure filings rose on an annual and quarterly basis in Arizona,
however.
One in every 49 homes there received a fo
b*d
发帖数: 9308
37
大家期望的利率下跌往往和实际不符呀。
NEW YORK (AP) -- Treasury prices are taking a plunge even after the Federal
Reserve stepped into the market to buy government bonds.
The Fed bought its first batch of Treasurys on Friday since announcing its $
600 billion plan to boost the economy last week. The central bank picked up
$7.23 billion in Treasurys coming due between 2014 and 2016.
The Fed's Treasury purchases are supposed to drive down long-term interest
rates over the long term. But Treasury prices dropped Frida... 阅读全帖
b********2
发帖数: 5191
38
来自主题: Living版 - ING 给了个refin offer, jump?
of course, jump
t**********g
发帖数: 3388
39
【 以下文字转载自 Automobile 讨论区 】
发信人: thanksgiving (###), 信区: Automobile
标 题: jump start的时候不小心两根cable碰在一起,打火花了
发信站: BBS 未名空间站 (Wed Jul 11 00:18:59 2012, 美东)
大家骂我吧。
接好车电池时不小心两根cable碰在一起,打了火花。当时马上就分开了。
后来开这辆车没有发现问题。
请教牛人这样电池会不会已经造成什么potential problem?
b********2
发帖数: 5191
40
【 以下文字转载自 CaliforniaMortgage 俱乐部 】
发信人: blueangel2 (Feedback is power), 信区: CaliforniaMortgage
标 题: Interest Rates Jump to Highest Level in Three Months zz
发信站: BBS 未名空间站 (Wed Aug 15 19:03:37 2012, 美东)
Treasury yields moved to their highest level in three-months Wednesday, as
selling hit the bonds sought as the safest haven in a scary world just a
month ago.
Traders said improving U.S. economic data was behind the selling. But they
also pointed to a big seller overnight during the Asian session... 阅读全帖
y******n
发帖数: 8667
41
http://money.cnn.com/2013/06/27/real_estate/mortgage-interest/i
Rising interest rates have hit mortgages big time.
Rates on 30-year, fixed-rate home loans spiked 0.53 percentage points to an
average of 4.46% this week -- the largest weekly increase in more than 26
years, mortgage giant Freddie Mac said Thursday.
The 30-year loan, which stood at 3.35% as recently as early May, is at its
highest level since July 2011.
Rates for 15-year loans, popular with homeowners refinancing their mortgages
, j... 阅读全帖
J**S
发帖数: 25790
42
来自主题: Living版 - 谁推荐一个JUMP START吧
我一一个JUMP START用了一次,就不用了,现在一点电都冲不上了。不知道是不是质量
太差?
现在急需一个,有谁有DEAL推荐?质量好,更好。
G***G
发帖数: 16778
m******r
发帖数: 6963
44
Builders broke ground on more homes than expected in November, and applied
for more permits for future construction, another sign that the housing
market has decisively hit its stride.
Housing starts rose 10.5% to a seasonally adjusted annual rate of 1.17
million, the Commerce Department said Wednesday. Permits, which foreshadow
future starts activity, jumped 11.0% to a 1.29 million pace, the strongest
since June.
While housing construction has largely been driven by multifamily buildings
in rec... 阅读全帖
G****s
发帖数: 87
45
来自主题: Money版 - Re: plan to jump on Etrade next month
called Etrade, they said the 6 months is from the date I opened
my last account, so, every old cop, let's jump again!~
BM please M.
f****t
发帖数: 1770
46
来自主题: NextGeneration版 - Happy Thanksgiving! Baby likes jumping
Baby just learned how to jump with his new toy and he seemed pretty excited about it.
http://www.youtube.com/watch?v=cJmkQVdE7Lo
b******o
发帖数: 44
47
来自主题: NextGeneration版 - Boston地区 graco jump & jive 转让
全新,小宝宝太胖,玩了一次不稀罕
Graco Jump N Jive Doorway Jumper with Interactive Musical Mat
amazon link
http://www.amazon.com/Graco-Doorway-Jumper-Interactive-Musical/
网上评价都不错
有要的站内联系
c***y
发帖数: 1064
48
那种充气的bounce and jump house大家觉得有必要买吗?有小女快两岁了。
谢谢
f*******r
发帖数: 1348
49
去外面的jump house玩不更有趣么?放在家里玩几天就boring了,我家的孩子是这样。
m********y
发帖数: 21909
50
我见有人租一个在生日party上,我儿子就在床上jump, 我想不久我就要换mattress了
首页 上页 1 2 3 4 5 6 7 8 9 10 (共10页)