求助:请学医的娃爸娃妈进来看看# Parenting - 为人父母
G*A
1 楼
都是大家熟悉的题
Q1, nth Fibonacci number. 要求尽可能多的解法。
follow-up, 每种解法的time/space complexity (要求function call的stack
overhead也看做space complexity).
Q2: c++基本概念。static, reference vs pointer, what is OOD, ...
Q3:列举并比较你常用的几种design patterns的作用和特点。
Q4: tree traversal, 要求level by level,按从底向上的顺序。同个level从左到右。
当我说要用DFS实现print by level的时候,此senior engineer先说“How could you
possibly print in level-order using DFS?”
解释完之后,senior engineer说:“ In the worst case, this will have
quadratic run time (if the tree is unbalanced). I was wondering about your
motivation to use DFS instead. It is quite a counter-intuitive
implementation.”
感觉是要被黑的套路,也就不想说什么了。尽管我记得以前推过:用DFS print in
level-order, average case 也是O(n).
update: 一点教训,尽量顺着面试官的思路说。这个小印senior在他认为“impossible
”的方法被证明“possible”之后态度明显有变化,变得很不nice。搞得我都开始犹
豫纠正不纠正他complexity分析的错误了。
Q1, nth Fibonacci number. 要求尽可能多的解法。
follow-up, 每种解法的time/space complexity (要求function call的stack
overhead也看做space complexity).
Q2: c++基本概念。static, reference vs pointer, what is OOD, ...
Q3:列举并比较你常用的几种design patterns的作用和特点。
Q4: tree traversal, 要求level by level,按从底向上的顺序。同个level从左到右。
当我说要用DFS实现print by level的时候,此senior engineer先说“How could you
possibly print in level-order using DFS?”
解释完之后,senior engineer说:“ In the worst case, this will have
quadratic run time (if the tree is unbalanced). I was wondering about your
motivation to use DFS instead. It is quite a counter-intuitive
implementation.”
感觉是要被黑的套路,也就不想说什么了。尽管我记得以前推过:用DFS print in
level-order, average case 也是O(n).
update: 一点教训,尽量顺着面试官的思路说。这个小印senior在他认为“impossible
”的方法被证明“possible”之后态度明显有变化,变得很不nice。搞得我都开始犹
豫纠正不纠正他complexity分析的错误了。