由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - career cup 上9.4题答案是否正确
相关主题
请教 Cracking the Coding Interview 上一道题careerup 150 上一道题 答案没看懂?
问个题实习职位: Computational Intelligence in RF Circuit Design
关于搭人梯那道题,careercup上面的答案错的吧内推PayPal
再来cc150一问Maximum Sum of Increasing Sequence
请教careercup上的一道题面试题count # of increasing subsequences of String求解
Cracking Ed4里的9.7 答案有错吗?EPI 题目
一道google 题,谁给翻译一下意思,多谢。借人气问一道Samsung的题
招Graphic Designer IV, Web Developer(WordPress)G家面试题: Longest Increasing Sequence 2D matrix
相关话题的讨论汇总
话题: largest话题: tower话题: increasing话题: sequence话题: person
进入JobHunting版参与讨论
1 (共1页)
i********s
发帖数: 133
1
A circus is designing a tower routine consisting of people standing atop one
another’s shoulders. For practical and aesthetic reasons, each person must
be both shorter and lighter than the person below him or her. Given the
heights and weights of each person in the circus, write a method to compute
the largest possible number of people in such a tower.
EXAMPLE:
Input (ht, wt): (65, 100) (70, 150) (56, 90) (75, 190) (60, 95) (68, 110)
Output: The longest tower is length 6 and includes from top to bottom: (56,
90) (60,95) (65,100) (68,110) (70,150) (75,190)
g*******s
发帖数: 490
2
第2步就是典型的dynamic programming
a[0].....a[n]
j->0,n, 对于每个状态j,找到以a[j]结尾的largest increasing sequence.
然后状态j+1怎么得到,比较a[j+1] with a[0]...a[j], if a[j+1] > a[i] and a[i]
has the largest increasing sequence among a[0]...a[j], the largest increasing
sequence for 状态j+1 = the largest increasing
sequence for 状态 i + a[j+1]
至于career cup上的第2步做法也是对的,就是了
1 (共1页)
进入JobHunting版参与讨论
相关主题
G家面试题: Longest Increasing Sequence 2D matrix请教careercup上的一道题
狗家 题 讨论Cracking Ed4里的9.7 答案有错吗?
找工作近乎绝望,觉得可能还是简历的问题,请大家帮忙看看 (转载)一道google 题,谁给翻译一下意思,多谢。
请教一个DP的题招Graphic Designer IV, Web Developer(WordPress)
请教 Cracking the Coding Interview 上一道题careerup 150 上一道题 答案没看懂?
问个题实习职位: Computational Intelligence in RF Circuit Design
关于搭人梯那道题,careercup上面的答案错的吧内推PayPal
再来cc150一问Maximum Sum of Increasing Sequence
相关话题的讨论汇总
话题: largest话题: tower话题: increasing话题: sequence话题: person