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 LRUCache

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

LRUCache implement Least Recently Used (LRU) cache.

func Constructor

func Constructor(capacity int) LRUCache

Constructor creates and initializes a new LRUCache using capacity as its capacity.

func (*LRUCache) Get

func (c *LRUCache) Get(key int) int

Get get the value of the key if the key exists in the cache, otherwise return -1.

func (*LRUCache) Put

func (c *LRUCache) Put(key, value int)

Put set or insert the value if the key is not already present.

Jump to

Keyboard shortcuts

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