由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 请教一下一道EPI上面的题
相关主题
有一道Java多线程的面试题能不能帮我看看?考古--用户最多的3连击问题
Pure Storage面经find 5 smallest number in a billion number list
A面试题这个怎么解:找到N^2个数的中数
求解一道算法题Leetcode上Two sum只能过3个case, VS能过,大牛进来看看是怎么回事
一道Iterator题在 1 billion 的数中找 median
hashmap和hashtable的区别?Amazon一道synchronization的面试题
Please recommend a C++ book for interview我发现我竟然学会了12种tree traversal的办法
一道算法题目请问怎样写没有parent pointer的BST iterator?
相关话题的讨论汇总
话题: each话题: number话题: person话题: two话题: cards
进入JobHunting版参与讨论
1 (共1页)
s********8
发帖数: 23
1
There are 25 people seated at a round table.Each person has two cards. Each
card has a number from 1 to 25. Each number appears on exactly two cards.
each person passes the card with the smaller number to the person on his
left. This is done iteratively in a synchronized fashion. Show that
eventually someone will have two cards with identical number. 不太清楚怎么推
导, 请版上的朋友指导. 谢谢
l*******4
发帖数: 1
2
可以不可以这么想:
一开始两个25 会被locate到两个不同的位置,因为是能移动的当前最大
然后两个24 会被locate到两个不同的位置,因为是能移动的当前最大
然后两个23 会被locate到两个不同的位置,因为是能移动的当前最大
.
.
.
然后两个13 会被locate到两个不同的位置,因为是能移动的当前最大
然后一个12 会被locate到一个位置,因为是能移动的当前最大且只有一个空格
剩下的另一个12会被一直pass,直到pass到那个有12的人手上
So someone have two cards with identical number eventually
1 (共1页)
进入JobHunting版参与讨论
相关主题
请问怎样写没有parent pointer的BST iterator?一道Iterator题
L家的高频题merge k sorted arrays giving iterators求讨论!hashmap和hashtable的区别?
reverse an arrayPlease recommend a C++ book for interview
一个系统设计问题一道算法题目
有一道Java多线程的面试题能不能帮我看看?考古--用户最多的3连击问题
Pure Storage面经find 5 smallest number in a billion number list
A面试题这个怎么解:找到N^2个数的中数
求解一道算法题Leetcode上Two sum只能过3个case, VS能过,大牛进来看看是怎么回事
相关话题的讨论汇总
话题: each话题: number话题: person话题: two话题: cards