Sunday, October 22, 2017

[LeetCode]Linked List Random Node


用Reservoir Sampling解即可,线性时间常数空间,代码如下:


No comments:

Post a Comment