René's URL Explorer Experiment


Title: #146 - LRU Cache - LeetCode JavaScript Solutions

Open Graph Title: #146 - LRU Cache - LeetCode JavaScript Solutions

X Title: #146 - LRU Cache - LeetCode JavaScript Solutions

Description: Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. Implement the LRUCache class: LRUCache(int capac...

Open Graph Description: Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. Implement the LRUCache class: LRUCache(int capac...

X Description: Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. Implement the LRUCache class: LRUCache(int capac...

Keywords:

Opengraph URL: https://leetcodejavascript.com/solutions/lru-cache

direct link

Domain: leetcodejavascript.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"Code","url":"https://leetcodejavascript.com/solutions/lru-cache","name":"#146 - LRU Cache - LeetCode JavaScript Solutions","description":"Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. Implement the LRUCache class: LRUCache(int capac...","programmingLanguage":"JavaScript","codeRepository":"https://github.com/JoshCrozier/leetcode-javascript","codeSampleType":"JavaScript","text":"/**\n * @param {number} capacity\n */\nvar LRUCache = function(capacity) {\n this.cache = new Map();\n this.capacity = capacity;\n};\n\n/**\n * @param {number} key\n * @return {number}\n */\nLRUCache.prototype.get = function(key) {\n if (!this.cache.has(key)) {\n return -1;\n }\n\n const value = this.cache.get(key);\n this.cache.delete(key);\n this.cache.set(key, value);\n return this.cache.get(key);\n};\n\n/**\n * @param {number} key\n * @param {number} value\n * @return {void}\n */\nLRUCache.prototype.put = function(key, value) {\n if (this.cache.has(key)) {\n this.cache.delete(key);\n }\n this.cache.set(key, value);\n if (this.cache.size > this.capacity) {\n this.cache.delete(this.cache.keys().next().value);\n }\n};","keywords":"LeetCode 146, #146 - LRU Cache, Medium, JavaScript solution","learningResourceType":"Code","isAccessibleForFree":true,"educationalLevel":"intermediate","interactivityType":"mixed"}

authorLeetCodeJavascript.com
og:typearticle
og:imagehttps://leetcodejavascript.com/og-image.jpg
og:site_nameLeetCode JavaScript Solutions
twitter:cardsummary_large_image
twitter:urlhttps://leetcodejavascript.com/solutions/lru-cache
twitter:imagehttps://leetcodejavascript.com/og-image.jpg
twitter:creator@joshcrozier
theme-color#1f2937

Links:

LeetCodeJavascript.com https://leetcodejavascript.com/
Star on GitHubhttps://github.com/JoshCrozier/leetcode-javascript
Back to all solutionshttps://leetcodejavascript.com
View on LeetCode https://leetcode.com/problems/lru-cache/
View on GitHubhttps://github.com/JoshCrozier/leetcode-javascript/blob/master/solutions/0146-lru-cache.js
Hash Table https://leetcodejavascript.com/tags/hash-table
Design https://leetcodejavascript.com/tags/design
Linked List https://leetcodejavascript.com/tags/linked-list
Doubly-Linked Listhttps://leetcodejavascript.com/tags/doubly-linked-list
Josh Crozierhttps://joshcrozier.com

Viewport: width=device-width,initial-scale=1

Robots: index, follow


URLs of crawlers that visited me.