B*********h 发帖数: 800 | 1 ☆─────────────────────────────────────☆
saddest (Apple) 于 (Fri Nov 10 12:13:20 2006) 提到:
发信人: saddest (Apple), 信区: JobHunting
标 题: 一道面试题
发信站: BBS 未名空间站 (Fri Nov 10 12:11:30 2006), 转信
有一组数,位于1-1000,要你找出同样位于1-1000,但不属于这组数的其它数
要求:linear time, constant space.
我说用hashtable,他说浪费空间太多
☆─────────────────────────────────────☆
wenge (文革) 于 (Fri Nov 10 12:29:31 2006) 提到:
I guess all numbers should be different. If so you will have to add them up,
and then take the difference between your number a |
|