由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - An Bloomberg interview question
相关主题
求一下这题解法。Rejected After 2nd Phone Interview with Amazon
BB NON CS onsite面经请问如何准备多线程问题
今天Amazon的phone interview几个Java面试题 (转载)
Amazon First Round Phone Interview三连击
amazon第一轮电话要注意些什么问个关于set的题
Facebook电面新鲜出炉A家电面面经
问一个出现次数相关的算法题目在版上看到的G题
Amazon电面面经(1面和2面)bb家电面
相关话题的讨论汇总
话题: bloomberg话题: use话题: sll话题: linear话题: question
进入JobHunting版参与讨论
1 (共1页)
c**********e
发帖数: 2007
1
This is from other people's 面经:
"判断两个single linkedlist 是否merge。从naive讲起,说到了linear的两种解法。"
I can think of two approaches:
1. Use hashtable.
2. Use the address of last node of each SLL to compare with each node of the
other SLL
Are these the "linear的两种解法"? Thanks.
z****4
发帖数: 194
2
hashtable怎么用?

。"
the

【在 c**********e 的大作中提到】
: This is from other people's 面经:
: "判断两个single linkedlist 是否merge。从naive讲起,说到了linear的两种解法。"
: I can think of two approaches:
: 1. Use hashtable.
: 2. Use the address of last node of each SLL to compare with each node of the
: other SLL
: Are these the "linear的两种解法"? Thanks.

h*****f
发帖数: 248
3
you mean detecting duplicate elements in 2 linked lists?
P*******U
发帖数: 203
4
I think these are the two linear methods, roughly, both are O(n+m)
g*********e
发帖数: 14401
5
count the number of nodes in each list,
then move the longer list |Na-Nb| steps, then move both list
if they merge, the two pointer would be equivalent at some point.
O(n+m)
P*******U
发帖数: 203
6
In lz's description, only required to decide whether merge, but not asked to
find the merge place. Then comparing the last element is enough and much
simpler than your algo.

【在 g*********e 的大作中提到】
: count the number of nodes in each list,
: then move the longer list |Na-Nb| steps, then move both list
: if they merge, the two pointer would be equivalent at some point.
: O(n+m)

1 (共1页)
进入JobHunting版参与讨论
相关主题
bb家电面amazon第一轮电话要注意些什么
一定电挂了(G家)Facebook电面
Google电面汇报问一个出现次数相关的算法题目
判断linkedlist是否palindrome最优解法是什么?Amazon电面面经(1面和2面)
求一下这题解法。Rejected After 2nd Phone Interview with Amazon
BB NON CS onsite面经请问如何准备多线程问题
今天Amazon的phone interview几个Java面试题 (转载)
Amazon First Round Phone Interview三连击
相关话题的讨论汇总
话题: bloomberg话题: use话题: sll话题: linear话题: question