Google 电面

1 flatten the linked list
就是一个linked list不仅有next,还有down Node, 把它flatten成一个正常linked list
用recursive 和 iterative都写一遍 然后比较时间复杂度, 空间复杂度

写完之后还有时间,follow up是用来运行这个程序的machine都没什么内存,怎么完成这个程序,差不多答了mod hash,traverse the list twice, the first round assign the element id, the second generate Element class

Elem {
   level : 0
   self-id : 0
   down: 4
   cur : 1
   next : 2 persist the id of the machine
}

2 今天我同学的面试,不知道是不是女生,感觉题目挺简单的,也没follow up.


使用prefix sum做即可, 参考代码 在上面的链接里。

你谷歌过了吗?

没消息