注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
Google Japan 第二次面试感觉做得一般般,求 RP 跟建议
·
面试官打来,寒暄了一两句,就说 should we start? 我以为像上次一样,直接一道 leetcode hard 难度拍过来,没想到竟然问基础知识!
- ### Do u know **memory leak*?
c/c++, new/malloc forget to free memory delete C++, smart pointer, RAIIwhen we don’t use that resources(memory), will free it automaticallyreference counter(tech)golang, defer
问内存泄漏,只有竟可能展示能力了 (装逼), 说了常见的场景,C++ 智能指针,RAII,引用计数,甚至还说了 golang 的 defer - ### Do u know some methods to solve it?
valgrind
问我有没有在项目中解决过,只好说实习和参加 Wine 开源项目都没有遇到过,知道可以用 valgrind,只是在 demo 用过。 array, char a[100],boundary for(int i=0; i<=100; ++i) a[i] overflow strcpy,strncpy sequence [0x1001, 0x1002, ..] [1, 2, 3, 4] a[4] visit another address cause some problems, we may modify other values, write protected area* use buffer overflow, execute some code
缓冲区溢出,举了例子以及常见场景, 读写系统保护区呀, readOnly 部分,修改了其他东西
代码部分
- (Coding) Implement a key value store with an expiration date.
- example usage:
- key=url
- value=html source
- void put(int key, int value) {
- }
- int get(int key) {
- }
一看, 特别简单,脑子进水了也能做那种。 但没有如此简单。quot; 后,迷之画风,他就说 "thanks, I think that's it" 之类的,大有结束之势。。 这面试官怎么不套路了?我赶紧问, "could I ask you a few questions?" 于是问了的确是编码中有点疑惑的问题: - code review 是怎么做的
- TDD,test 写吗,先写测试还是?
最后当然是最 xx 的问题, How is it working in google?
- code review, peer review
- peer review may not strict enough
- unit test every time?Is that test first?rule
- How is it working in google?
- chrome, arictue
- memory allocated, javascript -> C++, env open
- GSoC work
面试官变得有点话多的,的确很喜欢 Google,就说他是 做 chrome 的,做内存分布啥的,js 转 C++ 等, 参加过 GSoC too,工作就像是在做开源项目一样,excited! 表示 awesome!GSoC 非常棒! 结束面试:P
全部时间刚刚好 40 分钟
后记:
时间复杂度分析我出现问题了, 对优先队列和堆不够熟悉。
堆排序,put 复杂度是 O(n logn), get 是 O(1)
而优先队列在问题的场景下是用了堆实现的,所以 put 是插入,复杂度为 O(logn),并不是堆排序的排序复杂度。
|