Pergunta de entrevista da empresa Ola

Implement LRU cache

Respostas da entrevista

Sigiloso

21 de fev. de 2018

Pseudocode using various data structures like map and linked lists

1

Sigiloso

8 de jun. de 2018

public class LRUCache extends LinkedHashMap { private static float loadFactor = 0.75f; private static LRUCache cache ; int size; private LRUCache(int size) { super(size, loadFactor, true); this.size = size; } public static LRUCache getInstance(int size) { return new LRUCache(size); } @Override protected boolean removeEldestEntry(Map.Entry eldest) { return size() > size; } }