filmov
tv
Implement LRU Cache - Object Oriented System Design Interview Preparation - Leetcode 146 - Java

Показать описание
Design a LRU or Least Recently Used Cache - Leetcode 146 Java
#leetcodejava #codinginterviewprep #java #objectorientedprogramming #interview #coding #codinginterviewprep #faangcodinginterviewpreparation #faangpreparation #algorithms #algorithm
Problem Statement with Detail Solution atWebsite:
It is demonstrated how this data structure helps optimize real-world applications by efficiently managing cached data.
If you like quicker implementation for Leetcode, You can watch directly from here:
17:06 Showing an alternate way of implementing using a Linked Hashset (#leetcode)
In this Video, I have designed and implemented a Least Recently Used Cache that can serve GET and PUT operation in O(1) time complexity. For efficient lookup, I have used a HashMap and for cache eviction I have used a Double Ended LinkedList that can also serve as Queue. New elements are added at the end of the queue and for cache eviction I am removing elements from the beginning of the queue.
Join Linkedin group Algorithm Avengers to learn and share your thoughts regarding Problem Solving, Data Structures and Algorithms:
Timecode:
0:00 Intro to Design LRU Cache
0:37 Problem Statement from Leetcode
1:43 Understand The Problem with an example
5:07 Constraints for this problem
5:40 Walk through the code implementation
15:24 Running the code in browser for simple test cases
16:04 Showing actual time taken to run along with consumed memory
17:06 Showing an alternate way of implementing using a Linked Hashset
Problem statement with detail article:
Github Link:
@code_design
#leetcodejava #codinginterviewprep #java #objectorientedprogramming #interview #coding #codinginterviewprep #faangcodinginterviewpreparation #faangpreparation #algorithms #algorithm
Problem Statement with Detail Solution atWebsite:
It is demonstrated how this data structure helps optimize real-world applications by efficiently managing cached data.
If you like quicker implementation for Leetcode, You can watch directly from here:
17:06 Showing an alternate way of implementing using a Linked Hashset (#leetcode)
In this Video, I have designed and implemented a Least Recently Used Cache that can serve GET and PUT operation in O(1) time complexity. For efficient lookup, I have used a HashMap and for cache eviction I have used a Double Ended LinkedList that can also serve as Queue. New elements are added at the end of the queue and for cache eviction I am removing elements from the beginning of the queue.
Join Linkedin group Algorithm Avengers to learn and share your thoughts regarding Problem Solving, Data Structures and Algorithms:
Timecode:
0:00 Intro to Design LRU Cache
0:37 Problem Statement from Leetcode
1:43 Understand The Problem with an example
5:07 Constraints for this problem
5:40 Walk through the code implementation
15:24 Running the code in browser for simple test cases
16:04 Showing actual time taken to run along with consumed memory
17:06 Showing an alternate way of implementing using a Linked Hashset
Problem statement with detail article:
Github Link:
@code_design
Комментарии