Open gewhiz opened 9 years ago
binary tree level order traversal, 写了三种方法。。。(BFS用arraylist,类似 DFS,BFS用queue)
onsite:
hashmap,写完后继续要求要考虑multi-thread
linkedin 有两类用户,普通user和influencer,数据量都很大,写一个类, 要求O(1)的 get(user), set(user, type), getAllInfluencer. 我一开始用两个 hashset,问我有没更好的办法,后来问明白他其实就是想要bitset, 写出搞定
minimize the cost of painting K houses, each house has different costs to paint in different colors, 2 houses (next to each other) cannot be painted in the same color. DP
http://stackoverflow.com/questions/24646122/3-houses-and-minimum-cost-of-painting
singleton并让其thread-safe,还问到了lazy initialiation的和volatile关键字的意义