l*******o 发帖数: 791 | 1 刚放下电话,全是汗。
1. Empty class, what is the size? => 1
2. What the is inside empty class => four default functions
3. Copy ctor vs Assignment operator => one constructs object, the other one
assign object.
4. four classes, A,B,C,D. B and C both inherits A. D inherits B and C. What
is the problem here?
=> dead diamond. duplicate A in D. I said use virtual inheritance to avoid.
5. Anagram problem => sort it and put into the hash table to see it exits
already. If so, neglect it. If there any
way to be faster? 我支吾半天,他提示不用sort,给每个单词一个numerical
signature. 我说给a到z编号,1到26。算每
个单词的字母对应的编号和来计算是否是anangram,后来发现不能保证uniqueness,他
提示用multiplication,后来发
现这样做也不能保证unique。上帝突然照顾我,我突然想起小学的因数问题。我说给这
些数字重新编码,用prime数字编
码,这样每个词里面的数字对应的编码积一定是unique的。满手全是汗。
6.25马赛马问题,取前三。说实在的如果不是来本版看过题目,很难听懂这位印度面试
官的口语到底题目是什么样的。7
次,我给他推了一遍。
这就是我在38分钟内的所有面试题目。本人背景比较烂,cs硕士,从来没有用过C++做
过东西,就是上课做作业了。
大家请帮我看看我答得是不是对的。估计不行了。 | G********0 发帖数: 1359 | | d*********g 发帖数: 59 | | s*******t 发帖数: 248 | 4 你答得挺好的呀!应该有戏!
one
What
avoid.
【在 l*******o 的大作中提到】 : 刚放下电话,全是汗。 : 1. Empty class, what is the size? => 1 : 2. What the is inside empty class => four default functions : 3. Copy ctor vs Assignment operator => one constructs object, the other one : assign object. : 4. four classes, A,B,C,D. B and C both inherits A. D inherits B and C. What : is the problem here? : => dead diamond. duplicate A in D. I said use virtual inheritance to avoid. : 5. Anagram problem => sort it and put into the hash table to see it exits : already. If so, neglect it. If there any
| p*z 发帖数: 44 | | l*******o 发帖数: 791 | 6 我觉得才九个题目,太少了,是不是已经对我已经不用费力了。
【在 s*******t 的大作中提到】 : 你答得挺好的呀!应该有戏! : : one : What : avoid.
|
|