MCPcopy Index your code
hub / github.com/neetcode-gh/leetcode / moveToFront

Method moveToFront

javascript/0146-lru-cache.js:45–51  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

43 }
44
45 moveToFront(node) {
46 const [prev, next] = [this.tail.prev, this.tail];
47
48 this.tail.prev.next = node;
49 this.connectNode(node, { prev, next });
50 this.tail.prev = node;
51 }
52
53 connectNode(node, top) {
54 node.prev = top.prev;

Callers 2

putMethod · 0.95
getMethod · 0.95

Calls 1

connectNodeMethod · 0.95

Tested by

no test coverage detected