avatar
问一道面试题# JobHunting - 待字闺中
b*w
1
Three coke machines. Each one has two values min & max, which means if
you get coke from this machine it will load you a random volume in the range
[min, max]. Given a cup size n and minimum soda volume m, show if it's
possible to make it from these machines.
除了brute force还有什么好方法, 现在想到的是memorization, 把不成的都记下来
avatar
r*r
2
是说正好可乐把杯子装过m吗, 题目看不明白
avatar
b*w
3

应该是在[m, n] 范围内

【在 r****r 的大作中提到】
: 是说正好可乐把杯子装过m吗, 题目看不明白
avatar
n*s
4
it is possible to make what?

【在 b*******w 的大作中提到】
:
: 应该是在[m, n] 范围内

avatar
b*e
5
如果是实数的话肯定都可以。
如果只能是整数的话,则又一个上界。大于这个上届的都可以。小于此上界的可用DP求
解。

range

【在 b*******w 的大作中提到】
: Three coke machines. Each one has two values min & max, which means if
: you get coke from this machine it will load you a random volume in the range
: [min, max]. Given a cup size n and minimum soda volume m, show if it's
: possible to make it from these machines.
: 除了brute force还有什么好方法, 现在想到的是memorization, 把不成的都记下来
: 。

avatar
b*w
6

这里的上界是?

【在 b***e 的大作中提到】
: 如果是实数的话肯定都可以。
: 如果只能是整数的话,则又一个上界。大于这个上届的都可以。小于此上界的可用DP求
: 解。
:
: range

avatar
x*9
7
整数的话,就是backpack
实数的话,可以按3-sum来做
反正都差不多
avatar
s*r
8
Union{ [v1min,v1max], ..., [v3min, v3max],
[v1min+v2min,v1max+v2max], ..., [v2min+v3min, v2max+v3max],
[v1min+v2min+v3min,v1max+v2max+v3max]}
avatar
b*w
9

这里是允许多次取饮料吧.

【在 s*******r 的大作中提到】
: Union{ [v1min,v1max], ..., [v3min, v3max],
: [v1min+v2min,v1max+v2max], ..., [v2min+v3min, v2max+v3max],
: [v1min+v2min+v3min,v1max+v2max+v3max]}

avatar
y*a
10

No. It's enumerating lower bound and upper bound of all cases of using 1
machine, any two machines, and all three machines.

【在 b*******w 的大作中提到】
:
: 这里是允许多次取饮料吧.

avatar
b*w
11

I see. thx.

【在 y**********a 的大作中提到】
:
: No. It's enumerating lower bound and upper bound of all cases of using 1
: machine, any two machines, and all three machines.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。