Question d’entretien chez Ola

Implement LRU cache

Réponses aux questions d'entretien

Utilisateur anonyme

21 févr. 2018

Pseudocode using various data structures like map and linked lists

1

Utilisateur anonyme

8 juin 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; } }