t**g 发帖数: 1164 | 1 Given an array of integers where some numbers repeat 1 time, some numbers
repeat 2 times and only one number repeats 3 times, how do you find the
number that repeat 3 times. Using hash was not allowed.
有人说可以用XOR,可是我不是很明白
谁能解释下,谢谢! |
l*****a 发帖数: 14598 | 2 你怎么不问问”有人“?
出现一次的跟出现三次的混在一起,还真想不出来。。。
numbers
【在 t**g 的大作中提到】 : Given an array of integers where some numbers repeat 1 time, some numbers : repeat 2 times and only one number repeats 3 times, how do you find the : number that repeat 3 times. Using hash was not allowed. : 有人说可以用XOR,可是我不是很明白 : 谁能解释下,谢谢!
|
s*********t 发帖数: 1663 | 3 repeat 1 time是出现两次?
【在 t**g 的大作中提到】 : Given an array of integers where some numbers repeat 1 time, some numbers : repeat 2 times and only one number repeats 3 times, how do you find the : number that repeat 3 times. Using hash was not allowed. : 有人说可以用XOR,可是我不是很明白 : 谁能解释下,谢谢!
|
d**e 发帖数: 6098 | 4 能sort不?
数字连续不?
【在 t**g 的大作中提到】 : Given an array of integers where some numbers repeat 1 time, some numbers : repeat 2 times and only one number repeats 3 times, how do you find the : number that repeat 3 times. Using hash was not allowed. : 有人说可以用XOR,可是我不是很明白 : 谁能解释下,谢谢!
|
y**i 发帖数: 1112 | 5 我只知道只有一个数repeat 1 time的或者missing 1 number的情况,用XOR计算所有这
些数以及reference:1-N,所剩的结果就是要找的数了,因为相同的数XOR等于0,0
XOR 任何数等于那个数本身。其他的情况应该怎么解?难道都要去解方程?
【在 t**g 的大作中提到】 : Given an array of integers where some numbers repeat 1 time, some numbers : repeat 2 times and only one number repeats 3 times, how do you find the : number that repeat 3 times. Using hash was not allowed. : 有人说可以用XOR,可是我不是很明白 : 谁能解释下,谢谢!
|
s*********t 发帖数: 1663 | 6 能sort不就结束了么。。
数字连续但没sort,有帮助?
【在 d**e 的大作中提到】 : 能sort不? : 数字连续不?
|
d**e 发帖数: 6098 | 7 没有,我只是想确定一下然后再想想
【在 s*********t 的大作中提到】 : 能sort不就结束了么。。 : 数字连续但没sort,有帮助?
|
s*********t 发帖数: 1663 | 8 似乎我已经白白浪费了很多时间了。。。
【在 d**e 的大作中提到】 : 没有,我只是想确定一下然后再想想
|
t**g 发帖数: 1164 | 9 careercup上的
大侠们只给出了xor的提示
没留下其它线索
所以来这边问问
【在 l*****a 的大作中提到】 : 你怎么不问问”有人“? : 出现一次的跟出现三次的混在一起,还真想不出来。。。 : : numbers
|
t**g 发帖数: 1164 | 10 我是原题copy过来
我的理解是只出现1次的和2次的可以有很多个
3次的只有一个
数字不一定连续
【在 d**e 的大作中提到】 : 能sort不? : 数字连续不?
|
l*****a 发帖数: 14598 | 11 could u post the original english version problem
【在 t**g 的大作中提到】 : careercup上的 : 大侠们只给出了xor的提示 : 没留下其它线索 : 所以来这边问问
|
d********2 发帖数: 135 | 12 可不可以这样?
先把不repeat的踢掉,只剩下repeat 1次和2次的,然后再用想同方法,把repeat 1次
的踢掉,就剩答案啦 |
c*******t 发帖数: 1095 | 13 难道不是用记下array里面每个数出现的次数, 等于3的就是了么?
谁给我讲讲这题有什么背景?我有啥没有理解清楚的? 不是单纯编程? |
s******a 发帖数: 103 | 14 You can't use hash.
I think sort the list will do the job.
【在 c*******t 的大作中提到】 : 难道不是用记下array里面每个数出现的次数, 等于3的就是了么? : 谁给我讲讲这题有什么背景?我有啥没有理解清楚的? 不是单纯编程?
|