Skip to content

Instantly share code, notes, and snippets.

LRU Cache

Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put.

Also, creating a new cache object should take an integer for the capacity of the cache. It should either be required or default to a value.

Notes

get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.

@pschipitsch
pschipitsch / access_policy.template
Created April 13, 2016 03:07
AWS Elasticsearch Service Access Policy Terraform Template
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": [
"es:ESHttpGet",
"es:ESHttpHead",
"es:ESHttpPost",