Wednesday, August 26, 2015

http://www.mitbbs.com/article_t/JobHunting/33037695.html

为了防止违反NDA,就不列出公司名了,就是一些常见公司。

1. Write a iterator to iterate a nested array.
   For example, for given array: [1, 2, [3, [4, 5], [6, 7], 8], 9, 10]
   call iterator.next() 10 times should return 1,2,3,4,5,6,7,8,9,10.
   用了stack存(array, index)的tuple。

2. LeetCode 原题,120 - Triange。有一点变种,给的是一维数组。

3. Implement HashTable 主要看dynamic expanding

4. Implement MaxHeap.

5. Topology sort,就是版上常见的给一些排过序的未知语言的词,求该语言的字母序
。要求实现核心算法。可以给出一些helper function定义不需实现。

6. LeetCode 付费题 157 & 158 - Read N Characters Given Read4()。提供int 
read4(char* buf),实现int read(char* buf, int len)。read4函数读至多4个字符,
除非EOF,并返回实际读到的字符个数。题没有难度要注意一些细节问题。

7. Given an array with length n + 1. The array contains numbers from 1 to n,
with one of the number duplicated. Now find the duplicated number.
   讨论各种解法以及时间空间复杂度,最后实现O(N)时间O(1)空间的解法。数组可以
mutate.

8. Given a bag of characters and a dictionary, find longest string that can 
be constructed.

9. Given a grid of characters and a dictionary, find all possible words from
grid.
   以上两题都用的标准Trie树解法。讨论复杂度,和优化方案。

10. Given a grid with 'o' and 'x'. Find minimum steps from top-left to 
bottom-right without touching 'x'.
   a) You can only move right or move down. (BFS or DP)
   b) You can move in all 4 directions. (BFS)

11. CS basics. Thread & Process, address space, how memory mapped file works
, etc.

同时感谢版上大牛们的内推:mitbbsfanfan, xjm,虽然都没有去成...

最后祝大家找工作顺利!

Friday, August 21, 2015

http://www.mitbbs.com/article_t/JobHunting/32722633.html

因为之前发过贴,背景就不赘述了,具体说说怎么准备还有面经吧。

骑驴找马,一月底开始刷leetcode,到三月中第一个面试,刷了一遍半吧,明显觉得写
第二遍的时候思路清晰多了,code也比第一遍的简洁。其他的就是每家面试前争对性的
看面经,能看多少是多少,四家只有L面经重复率很高,g家最不能预料题型。后面准备
design的时候都是乱看,一些fb tech talk的视频还有之前有人贴过的fb design的总
结,
但我基础不好,临时抱佛脚感觉也没什么用。面经我就只贴面完有及时记下来的,反正
也给过很多朋友了,就贴上来吧。

已经签了fb,准备八月初start,有同一期的pm我,哈。

脸书:

1.  Print all paths of a binary tree
I gave a recursive solution.

Then he wanted to give an iterative way.

2a. Fibonacci (iterative)

2b. Buckets of anagrams
[“cart”,”tarc”, “cat”, “act”, “ract”] -> [[“cart”, “tarc”, “
ract”], [“cat”, “act”]]

onsite design是tiny url, 估计interviewer也知道我没什么经验,问了个最简单的也
没答好。T-T
coding都比较easy。

领英:

1.  Return if two strings are isomorphic. (character 1-1 match)
“zoo” -> “fee”  ( z->f, o->e)               true
“zoo” -> “dui”  ( z->d, o->u, o-> )        false
“dui” -> “zoo” (d->z, u->o, i-> )         false

Use two hashmaps

*****************************************************************
2.  K nearest points (solution see below)  Time: O(nlgk)

*****************************************************************
1.  Search in rotated sorted array

*****************************************************************
2. public interface Intervals {

    /**
     * Adds an interval [from, to] into internal structure.
     */
    void addInterval(int from, int to);


    /**
     * Returns a total length covered by intervals.
     * If several intervals intersect, intersection should be counted only 
once.
     * Example:
     *
     * addInterval(3, 6)
     * addInterval(8, 9)
     * addInterval(1, 5)
     *
     * getTotalCoveredLength() -> 6
     * i.e. [1,5] and [3,6] intersect and give a total covered interval [1,6]
     * [1,6] and [8,9] don't intersect so total covered length is a sum for 
both intervals, that is 6.
     *
     * 0  1    2    3    4    5   6   7    8    9    10
     */
    int getTotalCoveredLength();
}

亚麻:

1a. Given 2 sorted, singly-linked lists, write a function that will merge 
them into a new sorted, singly-linked list

Ex.
1->2->4->8->16->32
2->4->6

1->2->2->4->4->6->8->16->32

*****************************************************************
1b. merge n sorted lists 
//   1 -> 3,
//   2 -> 5
//   4 

newhead: 1 -> 2 -> 3  -> 4 -> 5

*****************************************************************
1c. Given a Binary tree, print path from root to all nodes that are 
divisible by 5

Input:
    6
   / 
  5   7
     /   
    4    15
   /      | 
  3  10  2  8

Output:
6 5 
6 7 4 10
6 7 15

*****************************************************************
2. Given an array A (the array can be treated as a big number) and a number 
n, find the biggest number that you can reach to via n swaps. A swap can 
only happen in adjacent items. For example, given [1 3 4 2 5 7 9] and n = 1,
the biggest number is [3 1 4 2 5 7 9]

n=1, 3 1 4 2 5 7 9

n=2, 1 3 4 -> 1 4 3 -> 4  1 3

狗家:

1.  Reorder List (leetcode)

1->2->3->4->5   =>  1->5->2->4->3

*****************************************************************
2.  Abbreviation: apple can be abbreviated to 5, a4, 4e, a3e, …
    Given a target string (internationalization), and a set of strings, 
return the minimal length of abbreviation of this target string so that it 
won’t conflict with abbrs of the strings in the set. 

“apple”, [“blade”] -> a4 (5 is conflicted with “blade”)
“apple”, [“plain”, “amber”, “blade”]  ->  ???

Problem changed to:
If given a string and an abbreviation, return if the string matches abbr.

“internationalization”, “i5a11o1” -> true

*****************************************************************
Onsite:

1a. Write a function to get a positive integer n as input and return 0 or 1.
The probability of returning 1 should be 1/(2^n)

1b. Given an array, return the median. (talk about expected time complexity)


2a. Code review - a class which takes a string, split by separators and 
return the array of tokens (point out coding problems and indicate how you 
will implement it)

2b. Longest consecutive sequence (leetcode) (how do you handle duplicates)

2c. design: how to store files given the file paths and contents. (tree?) 

3a. Given an array and a number x, find out how many pairs satisfy (a[i], a[
j]) st. a[i]+a[j] < x

3b. follow up: if we want to find 3 items that adds up to a number < x

3c follow up: if we want to find k items. Time complexity: O(n^(k-1)*lgn)


4. Give a map which has some obstacles in it. Given a starting point S and 
ending point E, find the shortest path from S to E. Note that you can go to 
any(4) direction from S, but during the process, you can only go straight 
from the previous direction, unless you hit an obstacle.
i.e. if you are at (1, 1) and the next (1, 2) is blocked, you can only go to
(2, 1) or (0, 1)  


5a. Java “final” keyword

5b. 3-way partition: given an array and number x, reorder the array so that 
first part will be < x, middle part is = x, and final part is > x. 

5c. Design: given an array of integers and a range (i, j), we want to return
the min item in the range (balanced binary search tree)

5d. System design: given a machine, how to generate id so that they will not
duplicate; if we have multiple machines, what to do

Saturday, August 15, 2015

http://www.mitbbs.com/article_t/JobHunting/32675607.html

1.  把Heart Bleed Bug搞清楚。
从源代码到business impact,
你要能一清二楚而且表达得头头是道。

保证你们面见的大头都扫地相迎。
因为他们正身在噩梦之中,
不在乎有功,只在乎无过。

http://www.inferse.com/14435/heartbleed-bug-handling-security/

学习code quality/security audit.
几个人一起,把openssl 合力audit一次。
特别是用的少的部分, 互相交流,互相present。

最基本的比如:  web programming,
mobile programming, framework
有什么 coding standard,
secure coding practice.
有什么 常见的网络安全fail.
coursera 上有 CYBERSECURITY SPECIALIZATION。 
UT, 很多学校也有COURSEWORK

私心希望这样大家都可以自己养成好习惯,
而且知道怎样挑某族裔的刺,掌握主动权。  
可攻可守。

当然遇到烙印就别来这一套。
烙印最忌讳有人比他们能吹。
装书呆子,老实巴交,苦力怕事
最有机会被烙印放过。

2.  提高EQ

先入club, 再阅读:
http://www.mitbbs.com/club_bbsdoc/ITRelief.html

参照烙印的EQ:
http://www.mitbbs.com/clubarticle_t2/ITRelief/31121015.html



建议老中发动起来帮助老中政客们电话拉票,
学习目标: 聆听, 见机行事,  电话礼貌, 英语, 心理抗rejection, 责任感, 荣
誉心,移位思考。
老中政客们入选,你们以后resume也多一个reference, experience!
请当双赢来认真对待。 你们看烙印支持O8 campaign卖了苦力,就无数O8的
"恩主”出现了, 在技术公司政府狐假虎威。

SVCA征集全美义工Phone Banking:
http://www.mitbbs.com/article_t/CivilSociety/9909.html

Tipsheet by Aijie:

Phone bankings tips by our volunteer, Aijie.
1)打电话前,注意一下他们的性别,年龄,党派,地址,因为有的人家用一个电话,
甚至夫妻互换了电话。这样接通时自己可以有心理准备。称呼Mr.或者Ms.,而不是其
first name, 一方面是正式尊重,另一方面是因为知道姓,比知道名要容易,不会让对
方的第一反应是‘你怎么知道我的名字’。 对DM先不要说PK是共和党,侧重介绍PK做
了什么,尤其是为亚裔,作为我们的一份子为我们发声。
2)对典型的华人的名字,hello后可以直接用中文,尤其是40-50岁的人,一定会中文。
而且一些60岁左右的叔叔阿姨,他们不会英文,不至于开口就把他们吓走。对于不太确
定的名字,可用英文问是否可以讲中文。从对方口音,可以找认同感,比如来自大陆就
介绍自己也是,来自台湾就介绍PK也是,等等。
3) 打电话时间的选择,个人觉得11am-12pm, 最迟不能超过12:30pm,因为忙了一上午
,11开始大家会比较放松,好聊。最晚12半后应该都在吃饭,不好打扰。然后4pm-7pm
,最迟不能超过7:30pm,呵呵,比建议的8pm早了半小时。另外要注意对方下班开车时
间,如果遇到,可以说还是先注意驾车安全,晚些再打。
4)记录自己打电话的时间。如果中午没人接,晚上再打。2次后都没人接,第3次留言
。最多别超过3次,不然对方也会烦的。这一点和建议的也不一样。我用这种办法,找
到了几个第一次没接的,有了直接对话的机会,成功率大些。当然,如果建议还是第一
次就直接留言,我会照做。
5)对于不同的声音,不要马上反对。尊重对方,听他讲,再用事实和数据说话。我和
一位Xu太太聊了半个小时,她有几点不同的意见。(1)她是支持平权法案的,觉得不
能因为当初我们亚裔受益就支持,现在不受益就反对。我听她说完,称赞她关心实事,
为所有族裔利益考虑,有开明的思想,等等。然后再说历史的原因,50年前,为了那些
历史上受歧视压迫受到不公待遇的少数族裔和女性,有了平权AA,照顾他们,是真的为
少数族裔提供机会。而后来,加州的各个族裔在变化,一些有才华的学生却因为族裔而
受到逆向歧视不能入学。所以20年前才取消了平权,所有学生都用成绩来竞争,而不是
族裔。20年后,现在的SCA5不是平权,西裔人口已经接近40%,如果通过,就是为人数
占多数的族裔服务了。(2)Xu太又说不赞成华人只知道学习,就成绩好。我又先赞她
考虑周全,不能让孩子死读书。然后指出大学录取学生并不是只看GPA,学生的申请要
全方位发展,各项优秀,才能被看中。并用林书豪Jeremy Lin的例子来说。她很开心,
很喜欢林那样的。(3)Xu太说不喜欢竞选的人到了社区总是强调自己是亚裔,会为亚
裔争取利益。不能说对亚裔好,而是应该是对美国的发展好。我还是赞她有开明的思想
,民主的意识。然后再说,其实其他族裔的竞选者也都是打自己的社区这样说的。比如
奥巴马当年竞选,自己族裔的都去投票。首先要让自己的族裔支持自己,才有可能获得
更大的支持啊。后来Xu太也说明白为什么西裔的竞选也要这样,不管怎样,还是要支持
PK的。
6) 留言。因为没有反馈,我不知道效果如果。我录了一下几段留言的时长。范例用时
1:45-2min。我很喜欢Lei的简短版,约1min.我自己也有个简短版,和Lei的非常相似
,约1min.增加了一点,就是对于名字像华人的,我在说完PK后,用中文再说一遍他的
名字。
谢谢大家!一起努力!

http://www.mitbbs.com/article_t/JobHunting/32996813.html

Master + 3year 湾区超级屌丝三线非互联网公司,最近面了6家,按面的顺序一个一个
来报

Cloudera(offer):

phone: max points on a line
       binary tree inorder/preorder recursive/iterative

onsite:
       1.三哥implement ReadWriteLock
         implement stack using array
         java generic/template
       2.三哥get average on sliding window
         how to do it thread safe without lock
       3.lunch...
         given a matrix has 0 in it, find an area that has largest sum
         有点像leetcode那道小岛题
       4.三哥hiring manager talk 
         project presentation
       5.白人lead explain TCP/UDP protocol, how it works
         design RPC API
         how to do callback in java
       6.白人lead suppose a communication protocol breaks on "X" letter, how
do you encode a string.

这家是第一家面的,也是面的最烂的,考的基础知识太多,真心不记得,没想到给过了
,而且hire manager跟我说feedback是strong hire。。。lunch那轮阿三送我回
meeting room的时候突然说要考一个coding,尼玛只剩下10分钟,还好写出来了,不知
道他是不是想恶心我。hiring manager 人超级nice,可能是他力挺的吧,真没想到能
拿offer。有了第一个offer后面面起来会轻松不少。

offer: 155k + 10% + 200k value of stock over 4 years = 220k 
每年有refresh,stock是70%RSU+30%option,四月融了一大笔钱,估值4B,他们说年底
上市。阿三偏多,也看到国人了,每天中午包午餐,福利也不错。但是不像pre-ipo的
节奏,太lay back。


HortonWorks(offer):

phone1: Print all paths which sum to a given value in binary tree(including
negtive value)
         Implement hashtable
phone2:  LCA
         some basic question on Hadoop

onsite: 
        1.co-founder: implement concurrent hashmap, try your best to improve
performance
        2.三妈hiring manager: project presentation 
        3.Japanese: basic knowledge on REST api, DB transaction, ACID, CAP
                    design distributed K-V store 
                    reserve integer
        4.笑嘻嘻亲切三哥:binary tree serialize/de-serialize

co-founder 进来就打瞌睡,按JDK版本写了个简单版的给他,解释了下代码就开会去了。
三妈尼玛进来就臭脸,各种挑刺,各种刨根问底(她还真懂),到最后我把gossip 
protocol讲清楚了才有点笑容。最后一个三哥就是来搞笑的,不评价。

offer: 145k + 20k + 135k value of stock over 3 years = 210k
从第二年开始有30%的refresh,还是挺给力的其实。有一点一定要吐槽,三妈打电话给
我们公司以前的lead问他:“这货不错,我们想要他,你们以前是怎么管这货的,这货
加班勤奋么”。我已经当面说过over time没问题,我理解小公司的fast 节奏,但是她
这么背后一问就让人感觉很不爽。最后一点,全是阿三。。。
                    
Zenefits(offer):

phone:  restore binary tree from in-order/pre-order 
        string multiply
onsite: 1.ABC given “Zenefits is growing fast”, return "Zftienes is 
gwornig fsat"
          除了首位字母,中间顺序要完全随机,这道题上机写,要跑test。
          design a API how to render a progress bar
          design a login system(back end architecture)
        2.亚裔 minimum window substring preserve order
          不是leetcode那道,完全不一样的解法。上机写,要能跑test。
        3.三哥 tiny URL

感谢电面的国人大哥出leetcode原题放水!最后一个三哥态度嚣张,一边design一边反
驳说这里有问题那里有问题,问我zookeeper是什么,我以为他想考我内部的东西,结
果他说他没听说过这玩意。。。

Zenefits: 150k + 20k option(value 200k-220k) over 4 years = 200-210k
不是很给力的样子,虽然CTO亲自打电话发offer,也感觉到了诚意,聊了很久,非常热
情。我不敢在这评论Z,版上太容易拉仇恨了,不敢说。

Uber(offer, 已接受, 略)

Google(pending)

phone: 1.given an order string "abc" check if "aabdccd" maintain the order
       "aabdccd" -> true;
       "abbca"   -> false;
       2.abbre word, given a list of words, return a map contains abbre word
map to a list of original word
       abbre word means:   word -> w2d,  international -> i11l
       跟anagram差不多

onsite: 1.毛子 given "AABBCC" return "ABCABC", no same char next to each 
other
          "ABBB" -> exception
          "ABBA" -> "ABAB"
        2.国人 excel encoding, leetcode那个
          given [1,2,0,6,9] and target 81, return true if add “+” between 
numbers can add up to target. 12+0+69=81 -> true.
        3.白人小哥 java 一个数据结构改错,没什么tricky的地方
        4.三哥 abbre word again... follow up是 word->w2d, 另一个wold->wo1d, 
也就是说不能group起来,每个都是unique的
        5.毛子 maximum path from upper left to right bottom, follow up是除了
往下往右,还可以往左走,怎么避免死循环。

再次感谢国人大哥出简单题放水!Google奇怪的是没面我design题,全是coding,似乎
也没人看我简历。没什么好说的,general hire.

LinkedIn(pending)

phone: 考烂的两道 max product array 和 product exclude itself

onsite: 1.三哥校友+华人漂亮妹子 tiny url
        2.白人 project presentation
        3.三姐校友+不明种族detect intersection of two linked list
                         max points on a line
        4.国人+白男 房子上色问题,这题10分钟搞定,shadow白人看不下去了,上来
恶心了个几何题,不具参考性,因为太变态了,谁没见过能做出来绝逼数学系毕业。还
好他不是主面。
        5.host manager some behaviour + when a new version of API 上线,怎么
和client side 协调好切换版本,出问题了rollback 怎么做。

依然感谢国人电面放水。 如果recruiter没忽悠我的话应该是过了。第二轮那白人各种
赞,各种good,结果打分最低。

大概总结下,这次刷这么一轮没碰到什么难题,也没碰到不擅长的题型,基本就提笔写
的,刷到一个程度写题就是本能。。。唯一一个想了一会的就是Z的第二题。
在公司做的project可以适当放大,把没做完的也加进去,被interviewer提出问题,如
果这个部分你没有做,也要跟他说你可以怎么优化。要有over view on整个project,
尽量把握细节,讲的时候往你擅长的部分引到,这一点让人感觉你有ownership。我的
步奏是先介绍整个框架结构,project的motivation是什么,scale起来瓶颈在哪,sub-
project拆出来是怎么分的,为什么这么分,之间有什么dependency, sub-project我怎
么分配顺序的。
Design题一靠平常积累,二靠多看open source stack,当然要看细节和实现,光知道
大概没用的。

可以不喷了?