Redian新闻
>
请问空调出风口叶片的方向应该冲窗户还是冲房间内部
avatar
请问空调出风口叶片的方向应该冲窗户还是冲房间内部# Living
g*u
1
刚面的amazon,下面是第一轮的面经。
应该是位india guy. 英语说的很清楚,没有什么理解问题。
题目很少,但是没问 why amazon, regex expression的问题。
下面是问的问题:
1.看到简历里面写了 C++和 Java,列出2者的区别,至少3个,并加以解释比较。
2. 关于OOD的继承的概念问题:
class a;
class b extends class a;
Is there any problem in the following codeand why?
a A =new b();
b B=new a();
3.基于上面的问题,问了下面这个问题关于虚函数调用的问题
class a with public function foo();
class b extends class a, and overide function foo();
we have:
a A=new b();
A->foo();
which function get called? from class a or class b?
which function get called if we write in c++? noticing that by default the
function in c++ is not virtual, but in Java it is virtual.
4.寻找2个link list的intersection,并且返回该点
two solutions:
(1)using the unordered_set, firstly we visit the firstlinked list, and put
all the nodes into the set; then vist the second linked list, first check
if the nodes already in the set, if yes,then this node is the intersection
node; if not we will advance the pointer until we reach the end of the
second linked list.
avatar
A*a
2
家里的空调出风口都冲着窗户,就是说风出来先吹到窗户上,应该换180度让它吹向房
间内部吗?
avatar
a*s
3
zan~~

【在 g**u 的大作中提到】
: 刚面的amazon,下面是第一轮的面经。
: 应该是位india guy. 英语说的很清楚,没有什么理解问题。
: 题目很少,但是没问 why amazon, regex expression的问题。
: 下面是问的问题:
: 1.看到简历里面写了 C++和 Java,列出2者的区别,至少3个,并加以解释比较。
: 2. 关于OOD的继承的概念问题:
: class a;
: class b extends class a;
: Is there any problem in the following codeand why?
: a A =new b();

avatar
C*d
4
应该影响不大,但是我回选择吹向房间内部。
avatar
y*5
5
Thank you for your post.
2. 关于OOD的继承的概念问题:
class a;
class b extends class a;
Is there any problem in the following codeand why?
a A =new b();
========
Warning, object is cut shorter.
========
b B=new a();
=========
Error, segment fault.
=========
4.寻找2个link list的intersection,并且返回该点
two solutions:
(1)using the unordered_set, firstly we visit the firstlinked list, and
put
all the nodes into the set; then vist the second linked list, first
check
if the nodes already in the set, if yes,then this node is the
intersection
node; if not we will advance the pointer until we reach the end of the
second linked list.
avatar
P*l
6
zan
avatar
P*l
7
zan
avatar
l*8
8
谢谢楼主分享。
祝你好运!
你申请的什么方向和职位? 怎么感觉跟之前看到的面经有点儿不一样?

【在 g**u 的大作中提到】
: 刚面的amazon,下面是第一轮的面经。
: 应该是位india guy. 英语说的很清楚,没有什么理解问题。
: 题目很少,但是没问 why amazon, regex expression的问题。
: 下面是问的问题:
: 1.看到简历里面写了 C++和 Java,列出2者的区别,至少3个,并加以解释比较。
: 2. 关于OOD的继承的概念问题:
: class a;
: class b extends class a;
: Is there any problem in the following codeand why?
: a A =new b();

avatar
g*u
9

In fact, it is not exactely true.
In C++(Visual studio.net 2008), the first assignment, the compilation error
will complain for the first case, from b* --> a object. If you change it to
a *A=new b(), then the function called will be the one in the base because
the function in the base is non-virtual by default.
The second assignment, the compiler will error out again: can not convert
from b*-->a*.
BUT in Java, it is different, all these two will pass the compile time
test, and the output depends on the right-side type. Namely, the first
assignment, it will use the foo() in b, and second case, it will use the foo
() in a.

【在 y******5 的大作中提到】
: Thank you for your post.
: 2. 关于OOD的继承的概念问题:
: class a;
: class b extends class a;
: Is there any problem in the following codeand why?
: a A =new b();
: ========
: Warning, object is cut shorter.
: ========
: b B=new a();

avatar
g*u
10

学校career fair上, 我投了简历,后来就有recruiter开始联系了。 问了recruiter
什么组,但是被忽视了问题....

【在 l*********8 的大作中提到】
: 谢谢楼主分享。
: 祝你好运!
: 你申请的什么方向和职位? 怎么感觉跟之前看到的面经有点儿不一样?

avatar
g*u
11

As for the intersection of linked list, your method will find the
intersection for sure, but it will not always save space. Assuming we have
list1 with m nodes, and list2 with 2 nodes, and they intersect at the last
nodes, so in your implementation, you visit these two linked list at the
same time, assuming you advance two pointers at the same time, after two
steps, the second one reaches its end, and the first one will visit its
third node, you will need to visit the rest of the first node until you
reach its end, and find this intersection, also you need to save these two
nodes at two linked list.
My methos will requires to save nodes in one linked list, but for the second
one, no need to save, just to check whether it is in the set or not.
Also, set is implemented using balanced-tree, so it will be better to use
unordered_set(in the std::tr1 space in .net 2008).

【在 y******5 的大作中提到】
: Thank you for your post.
: 2. 关于OOD的继承的概念问题:
: class a;
: class b extends class a;
: Is there any problem in the following codeand why?
: a A =new b();
: ========
: Warning, object is cut shorter.
: ========
: b B=new a();

avatar
y*5
12
Sorry for confusion. I know your code is for java, but I am not familiar
with it. So, I automatically using C++. Of course in C++ we need to change
the code from a to a*. Because size of b is no less than a, if we assign
address of an object of b to a-type pointer, b's own fields will be hidden.
That is why I said it is cut shorter.
If we assign address of an object of a to b-type pointer, there will always
be an error in C++.

In fact, it is not exactely true.
In C++(Visual studio.net 2008), the first assignment, the compilation error
will complain for the first case, from b* --> a object. If you change it to
a *A=new b(), then the function called will be the one in the base because
the function in the base is non-virtual by default.
The second assignment, the compiler will error out again: can not convert
from b*-->a*.
BUT in Java, it is different, all these two will pass the compile time
test, and the output depends on the right-side type. Namely, the first
assignment, it will use the foo() in b, and second case, it will use the foo
() in a.

【在 y******5 的大作中提到】
: Thank you for your post.
: 2. 关于OOD的继承的概念问题:
: class a;
: class b extends class a;
: Is there any problem in the following codeand why?
: a A =new b();
: ========
: Warning, object is cut shorter.
: ========
: b B=new a();

avatar
y*5
13
Yes, you are right. The worse case of my solution will use O(n+m) space and
yours is O(n). This question is actually the same with "lowest ancestor in
binary tree", and here is a summary of our 3 solutions:
1. Visit two lists at the same time and keep a set or hashtable.
Space complexity: O(n+m), time complexity: O(min(n, m))
2. Visit and record one list first.
Space complexity: O(n), time complexity: Omega(n)
3. Make start points at the same level.
Space complexity: O(1), time complexity: Omega(n+m)
Please correct me if I am wrong.

second

【在 g**u 的大作中提到】
:
: As for the intersection of linked list, your method will find the
: intersection for sure, but it will not always save space. Assuming we have
: list1 with m nodes, and list2 with 2 nodes, and they intersect at the last
: nodes, so in your implementation, you visit these two linked list at the
: same time, assuming you advance two pointers at the same time, after two
: steps, the second one reaches its end, and the first one will visit its
: third node, you will need to visit the rest of the first node until you
: reach its end, and find this intersection, also you need to save these two
: nodes at two linked list.

avatar
l*o
14
比我面的简单很多,面试某种程度上拼运气,btw,lz申请的而是什么position?
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。