N*D 发帖数: 3641 | 1 【 以下文字转载自 JobHunting 讨论区 】
发信人: NND (NND), 信区: JobHunting
标 题: Re: 这个题怎解?
发信站: BBS 未名空间站 (Sat Nov 3 21:02:53 2007), 转信
简单点说,就是n个数,a1,a2,....,an,每个数都属于某一个group,需要测试这n个数
中受否存在一半或者以上的数属于同一个group
能允许的操作compare(ai,aj),告诉你是否是同一个组。
要求时间O(n)
A bank has a collection of n bank cards that they’ve confiscated, suspectin
g them of being used in a fraud. Each bank card corresponds to a unique acco
unt in the bank. Each account can have many cards corresponding to it, and w
e’ll say that two bank cards are e | N*D 发帖数: 3641 | 2 这里高手多,借人气一问,谢谢
suspectin
acco
【在 N*D 的大作中提到】 : 【 以下文字转载自 JobHunting 讨论区 】 : 发信人: NND (NND), 信区: JobHunting : 标 题: Re: 这个题怎解? : 发信站: BBS 未名空间站 (Sat Nov 3 21:02:53 2007), 转信 : 简单点说,就是n个数,a1,a2,....,an,每个数都属于某一个group,需要测试这n个数 : 中受否存在一半或者以上的数属于同一个group : 能允许的操作compare(ai,aj),告诉你是否是同一个组。 : 要求时间O(n) : A bank has a collection of n bank cards that they’ve confiscated, suspectin : g them of being used in a fraud. Each bank card corresponds to a unique acco
| h*****k 发帖数: 5022 | 3 就 a1,a2 比,a3,a4比,如果没有一组相同,return false
如果有相同的,把相同的取出来,跟如果没比的an放一起再比 |
|