Frage im Vorstellungsgespräch bei Ola

Implement LRU cache

Antworten zu Vorstellungsgespräch

Anonym

21. Feb. 2018

Pseudocode using various data structures like map and linked lists

1

Anonym

8. Juni 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; } }