由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 再来cc150一问
相关主题
career cup 上9.4题答案是否正确实习职位: Computational Intelligence in RF Circuit Design
请教 Cracking the Coding Interview 上一道题交通灯OO design哪道题在哪里可以找到??
问个题一道T的onsite题
关于搭人梯那道题,careercup上面的答案错的吧cc150 4.7 一问
请教careercup上的一道题Amazon面经
Cracking Ed4里的9.7 答案有错吗?请教如何准备amazon的OO Design题
招Graphic Designer IV, Web Developer(WordPress)design parking lot 如何做
careerup 150 上一道题 答案没看懂?A家design怎么准备啊?
相关话题的讨论汇总
话题: 60话题: 排序话题: person话题: circus话题: 200
进入JobHunting版参与讨论
1 (共1页)
s********a
发帖数: 2796
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.
解答说是先按高度排序,然后重量排序。
那如果Input(ht, wt): (60, 200) (70, 150) (56, 90) (75, 190) (60, 95) (68,
110)
排序结果是(56,90)(60,95)(60,200)(68,110)(70,150)(75,190)
再按照解答的方法找最大序列,那么结果是3.
但是如果把(60,200)从序列中抽出去,结果不是能到5么?
i*******r
发帖数: 51
2
先按第一项排序,再找第二项最长递增子列

one
must
compute

【在 s********a 的大作中提到】
: 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.
: 解答说是先按高度排序,然后重量排序。
: 那如果Input(ht, wt): (60, 200) (70, 150) (56, 90) (75, 190) (60, 95) (68,
: 110)
: 排序结果是(56,90)(60,95)(60,200)(68,110)(70,150)(75,190)
: 再按照解答的方法找最大序列,那么结果是3.

s********a
发帖数: 2796
3
在上面这个例子中,如果把第二项中违反增长的那个去掉不更好么?

【在 i*******r 的大作中提到】
: 先按第一项排序,再找第二项最长递增子列
:
: one
: must
: compute

b*******g
发帖数: 57
4
结果是5,动态规划一下就行了
与longest increasing sequence类似,sequence不一定是连续的

one
must
compute

【在 s********a 的大作中提到】
: 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.
: 解答说是先按高度排序,然后重量排序。
: 那如果Input(ht, wt): (60, 200) (70, 150) (56, 90) (75, 190) (60, 95) (68,
: 110)
: 排序结果是(56,90)(60,95)(60,200)(68,110)(70,150)(75,190)
: 再按照解答的方法找最大序列,那么结果是3.

1 (共1页)
进入JobHunting版参与讨论
相关主题
A家design怎么准备啊?请教careercup上的一道题
epi 还是 The Algorithm Design ManualCracking Ed4里的9.7 答案有错吗?
design of web crawler招Graphic Designer IV, Web Developer(WordPress)
面试中design的问题怎么准备careerup 150 上一道题 答案没看懂?
career cup 上9.4题答案是否正确实习职位: Computational Intelligence in RF Circuit Design
请教 Cracking the Coding Interview 上一道题交通灯OO design哪道题在哪里可以找到??
问个题一道T的onsite题
关于搭人梯那道题,careercup上面的答案错的吧cc150 4.7 一问
相关话题的讨论汇总
话题: 60话题: 排序话题: person话题: circus话题: 200