Reservoir Sampling
zshouyi
这个作者很懒,什么都没留下…
展开
-
382. Linked List Random Node
Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen.Follow up:What if the linked list is extremely large and i原创 2017-06-17 13:01:00 · 225 阅读 · 0 评论 -
398. Random Pick Index
Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target number must exist in the array.Note:The array size c原创 2017-06-17 13:16:05 · 242 阅读 · 0 评论