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

Method get

javascript/0146-lru-cache.js:58–68  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

56 }
57
58 get(key) {
59 const hasKey = this.map.has(key);
60 if (!hasKey) return -1;
61
62 const node = this.map.get(key);
63
64 this.disconnectNode(node);
65 this.moveToFront(node);
66
67 return node.value;
68 }
69
70 disconnectNode(node) {
71 node.next.prev = node.prev;

Callers 15

putMethod · 0.95
getFrequencyMapFunction · 0.45
addRightFrequencyFunction · 0.45
subtractLeftFrequencyFunction · 0.45
checkSubarraySumFunction · 0.45
majorityElementFunction · 0.45
maxPointsFunction · 0.45
getAdjListFunction · 0.45
getValToIndexFunction · 0.45
numberOfGoodPathsFunction · 0.45
minDeletionsFunction · 0.45

Calls 2

disconnectNodeMethod · 0.95
moveToFrontMethod · 0.95

Tested by

no test coverage detected