leetcode

package
v0.0.0-...-0e3bca9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2019 License: Unlicense Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Solution

type Solution struct {
	// contains filtered or unexported fields
}

Solution is the solution for the reservoir sampling algorithm.

func Constructor

func Constructor(nums []int) Solution

Constructor accepts a slice of integers.

func (*Solution) Pick

func (s *Solution) Pick(target int) int

Pick randomly output the index of a given target number.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL