由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 请教一个面试题
相关主题
问几道面试题数组找唯一的出现奇数次元素除了hash,sort, xor怎么做?
Amazon 2nd Phone Interview数组找唯一的出现奇数次元素除了hash,sort, xor怎么做?
问一个面试题Given an array of N integers from range [0, N] and one is missing. Find the missing number.
数组找唯一的出现偶数次元素用 xor怎么做Bloomberg电面题目+ 攒RP for onsite
一道面试题T problem
Zenefits面经(已挂)问道题
问个面试题A家面试题
Google 面试题 一道Google电话面试题目
相关话题的讨论汇总
话题: repeat话题: xor话题: times话题: 面试题话题: numbers
进入JobHunting版参与讨论
1 (共1页)
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的就是了么?
: 谁给我讲讲这题有什么背景?我有啥没有理解清楚的? 不是单纯编程?

1 (共1页)
进入JobHunting版参与讨论
相关主题
Google电话面试题目一道面试题
Search in a sorted, rotated listZenefits面经(已挂)
问一道老题问个面试题
问道面试题Google 面试题 一道
问几道面试题数组找唯一的出现奇数次元素除了hash,sort, xor怎么做?
Amazon 2nd Phone Interview数组找唯一的出现奇数次元素除了hash,sort, xor怎么做?
问一个面试题Given an array of N integers from range [0, N] and one is missing. Find the missing number.
数组找唯一的出现偶数次元素用 xor怎么做Bloomberg电面题目+ 攒RP for onsite
相关话题的讨论汇总
话题: repeat话题: xor话题: times话题: 面试题话题: numbers