LRU Cache | lru cache | lru cache leetcode | leetcode 146

Опубликовано: 27 Август 2026
на канале: Akshay Goyal
1,189
41

Link to the code: https://pastebin.com/KvSHwzAJ
Link to the question: https://leetcode.com/problems/lru-cache/

*Complexity Analysis*

Time complexity: O(1) both for put and get.
Space complexity: O(capacity) since space is used only for a hashmap and double linked list with at most capacity + 1 elements.

SUPPORT MY WORK BY SUBSCRIBING TO THE CHANNEL :
   / @akshaygoyal2134  

LeetCode Playlist:    • Prison Cells After N Days | prison cells a...