MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / removeLastUsed

Method removeLastUsed

javascript/0146-lru-cache.js:21–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19 }
20
21 removeLastUsed() {
22 const [key, next, prev] = [
23 this.head.next.key,
24 this.head.next.next,
25 this.head,
26 ];
27
28 this.map.delete(key);
29 this.head.next = next;
30 this.head.next.prev = prev;
31 }
32
33 put(key, value) {
34 const hasKey = this.get(key) !== -1;

Callers 1

putMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected