leetcode

package
v0.0.0-...-cbd2a94 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2022 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