由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - good way to solve this problem?
相关主题
帮忙看个题二爷的那个Longest Consecutive Sequence的新解法?
please DIscuss Two similar alg questionsLongest Consecutive Sequence 问题释疑
one amazon interview problemleetcode longest consecutive sequence怎么做
问个AMAZON以前没讨论出结果的题leetcode longest consecutive sequence还是想不通!
longest increasing subsequence O(NlogN)算法中数组 P 是否必请教recursive backtracking问题的时间复杂度的分析
Ask a google interview question(2)请问leetcode 上那道Longest Consecutive Sequence题
Random Array number, Find longest consecutive sequence一道 facebook 电面题
fb电面第一轮G家面试题: Longest Increasing Sequence 2D matrix
相关话题的讨论汇总
话题: 13话题: chain话题: solve话题: starting话题: problem
进入JobHunting版参与讨论
1 (共1页)
w**z
发帖数: 8232
1
sequence defined for positive interger
n-> n/2 (n is even)
n-> 3n + 1 (n is odd)
starting from 13, we have
13, 40, 20, 10, 5, 16, 8, 4, 2, 1
which number under 1million, produces the longest chain.
d**********x
发帖数: 4083
2
dp

【在 w**z 的大作中提到】
: sequence defined for positive interger
: n-> n/2 (n is even)
: n-> 3n + 1 (n is odd)
: starting from 13, we have
: 13, 40, 20, 10, 5, 16, 8, 4, 2, 1
: which number under 1million, produces the longest chain.

d**u
发帖数: 1065
3
而且是一维数组的dp。
l*********8
发帖数: 4642
4
问一下:
starting from 13, we have
13, 40, 20, 10, 5, 16, 8, 4, 2, 1
上面的例子里chain长度为3吗? 4,2,1,4,2,1,4....

【在 w**z 的大作中提到】
: sequence defined for positive interger
: n-> n/2 (n is even)
: n-> 3n + 1 (n is odd)
: starting from 13, we have
: 13, 40, 20, 10, 5, 16, 8, 4, 2, 1
: which number under 1million, produces the longest chain.

w**z
发帖数: 8232
5
13 is the starting number, chain lenghth is 10

【在 l*********8 的大作中提到】
: 问一下:
: starting from 13, we have
: 13, 40, 20, 10, 5, 16, 8, 4, 2, 1
: 上面的例子里chain长度为3吗? 4,2,1,4,2,1,4....

l*********8
发帖数: 4642
6
为什么chain到1结束?
1后面还可以是4啊

【在 w**z 的大作中提到】
: 13 is the starting number, chain lenghth is 10
w**z
发帖数: 8232
7
I guess we can assume it stops at 1.

【在 l*********8 的大作中提到】
: 为什么chain到1结束?
: 1后面还可以是4啊

d**********x
发帖数: 4083
8
这个是著名的3n + 1问题。。

【在 l*********8 的大作中提到】
: 为什么chain到1结束?
: 1后面还可以是4啊

h*******s
发帖数: 8454
9
http://zh.wikipedia.org/wiki/考拉兹猜想

【在 w**z 的大作中提到】
: I guess we can assume it stops at 1.
y**********u
发帖数: 6366
10
http://uva.onlinejudge.org/index.php?option=onlinejudge&Itemid=

【在 w**z 的大作中提到】
: I guess we can assume it stops at 1.
相关主题
Ask a google interview question(2)二爷的那个Longest Consecutive Sequence的新解法?
Random Array number, Find longest consecutive sequenceLongest Consecutive Sequence 问题释疑
fb电面第一轮leetcode longest consecutive sequence怎么做
进入JobHunting版参与讨论
w**z
发帖数: 8232
11
yes, you are right:
http://online-judge.uva.es/p/v1/100.html
Any good solution?

【在 d**********x 的大作中提到】
: 这个是著名的3n + 1问题。。
l*********8
发帖数: 4642
12
看来这道题过online judge的话, 直接算就可以了。
”數目少於1億的,步驟中最高的數是63728127,共有949個步驟“。

【在 h*******s 的大作中提到】
: http://zh.wikipedia.org/wiki/考拉兹猜想
w**z
发帖数: 8232
13
只要不timout 就行了:)

【在 l*********8 的大作中提到】
: 看来这道题过online judge的话, 直接算就可以了。
: ”數目少於1億的,步驟中最高的數是63728127,共有949個步驟“。

h****e
发帖数: 928
14
这道题就是直接算,只是在online judge上有一个trick,
就是输入可能是i>j,所以你在开始循环之前要判断一下,
这样loop中的初值和终值才对。
w**z
发帖数: 8232
15
这样的DP,我还可以handle

【在 d**u 的大作中提到】
: 而且是一维数组的dp。
w**z
发帖数: 8232
16
谢了。

【在 h****e 的大作中提到】
: 这道题就是直接算,只是在online judge上有一个trick,
: 就是输入可能是i>j,所以你在开始循环之前要判断一下,
: 这样loop中的初值和终值才对。

w**z
发帖数: 8232
17
谢谢语文。

【在 y**********u 的大作中提到】
: http://uva.onlinejudge.org/index.php?option=onlinejudge&Itemid=
1 (共1页)
进入JobHunting版参与讨论
相关主题
G家面试题: Longest Increasing Sequence 2D matrixlongest increasing subsequence O(NlogN)算法中数组 P 是否必
有木有人最近做 two sigma 的 online TestAsk a google interview question(2)
问个近来看到的狗家题:longest consecutive sequence in treeRandom Array number, Find longest consecutive sequence
面试题fb电面第一轮
帮忙看个题二爷的那个Longest Consecutive Sequence的新解法?
please DIscuss Two similar alg questionsLongest Consecutive Sequence 问题释疑
one amazon interview problemleetcode longest consecutive sequence怎么做
问个AMAZON以前没讨论出结果的题leetcode longest consecutive sequence还是想不通!
相关话题的讨论汇总
话题: 13话题: chain话题: solve话题: starting话题: problem