Тёмный

How to Implement an LRU Cache (Leetcode  

Byte by Byte
Подписаться 69 тыс.
Просмотров 35 тыс.
50% 1

How to Implement an LRU Cache (Leetcode #146 explained) // Are you ready to solve this coding interview question in your interview?
One of the most popular Google interview questions is to ask coding interview candidates to implement an LRU cache, or least recently used cache. Basically, you are implementing a cache with an eviction policy that evicts the least recently used element.
This is a great coding interview question because it tests your knowledge of hash tables and linked lists as well as general design patterns and caching algorithms. Make sure you know how to solve this classic Leetcode question before your next coding interview!
RESOURCES & LINKS MENTIONED IN THIS VIDEO:
Implement an LRU Cache (Leetcode #146): leetcode.com/p...
50 Coding Interview Questions Guide: www.byte-by-by...
[FREE EBOOK] Dynamic Programming for Interviews: www.byte-by-by...
Coding Interview Questions and Answers Playlist: • Interview Question: Fi...
YOU CAN ALSO FIND ME HERE
Website: www.byte-by-by...
Twitter: / bytebybyteblog
Facebook: / bytebybyteblog
• How to Implement an LR...

Наука

Опубликовано:

 

15 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 39   
@ByteByByte
@ByteByByte 4 года назад
I’m working on a bunch of new technical content. Let me know if there are any problems/algorithms you’d like to see me teach!
@Firstusee256
@Firstusee256 4 года назад
Graphs and DP
@ByteByByte
@ByteByByte 4 года назад
Dev- House any particular problems or algorithms?
@eyitayoogunbiyi2631
@eyitayoogunbiyi2631 4 года назад
Please work on leetcode.com/problems/unique-binary-search-trees/ (dp + trees)
@quantumlexa
@quantumlexa 4 года назад
it would be nice to see an explanation of KMP here
@smirkedShoe
@smirkedShoe 4 года назад
Karastuba Algorithm
@sarthaksrivastav3408
@sarthaksrivastav3408 4 года назад
This is by far the best explanation for this problem for me, you explained the whole thought process like why should we use map, why doubly linked list and not singly linked list etc. Thank you.
@luzengyuan5326
@luzengyuan5326 3 года назад
after i spent couple of hours for different videos, this is the best which explain clearly between doubly linked list and map. thanks
@PhilipMaessoumi
@PhilipMaessoumi 4 месяца назад
Thank you for your video, I had seen other videos using your type of solution for this problem, but you were the first one who explained it clearly.
@adityasethi9794
@adityasethi9794 8 месяцев назад
Lovely explanation man. The pace at which he talks and explains automatically makes it easy to understand.
@AnantaAkash.Podder
@AnantaAkash.Podder 4 месяца назад
Thank you very much... A wonderful & nice explanation...
@anilerengocer6254
@anilerengocer6254 4 дня назад
Nice explanation.
@ChrisDieringer
@ChrisDieringer 27 дней назад
Use of the map data-structure kind of hand-waves over the interesting bits of the O(1) requirement. That is to say, how can we assert that the backing map impl actually is O(1) for insert & put? Presuming the Map is actually backed by a tree, i'd wager that O(1) ops are not actually O(1), but probably O(log n). If a hashmap is used, you can get O(1) time, but given that O(1) was a key requirement of the video, "just use a map" may or may not be adequate explanation if you need to defend the solution to someone such as an interviewer. Agree/disagree?
@guilhermenunes9776
@guilhermenunes9776 2 года назад
Thankss... I finally understood how map connects with the linked list. I've watched so many videos O.o
@Hyperian
@Hyperian 4 года назад
You should do way more of these!
@ByteByByte
@ByteByByte 4 года назад
Hyperian that’s the plan! Anything specific you want to see?
@f3-faithfitnessfinance
@f3-faithfitnessfinance 4 года назад
@@ByteByByte Spiral matrix 3
@jlecampana
@jlecampana 4 года назад
Hi Sam! It’s about time someone created a clear explanation to this problem! Hey, what App is that for the digital whiteboard? Thanks!
@ByteByByte
@ByteByByte 4 года назад
jlstr Thanks! Glad you enjoyed it. And it’s an iPad app called Whiteboard Brush Whiteboard Brush by Lidong Chen apps.apple.com/us/app/whiteboard-brush/id496465537
@marianopatino-paul5062
@marianopatino-paul5062 3 года назад
Best explanation ever!!
@ganeshchowdhary3024
@ganeshchowdhary3024 4 года назад
Expert level competitive programming algorithms.
@prernacore
@prernacore 3 года назад
such a clear explanation
@zn4798
@zn4798 3 года назад
Do you have any code solution for that?
@aileenchan3741
@aileenchan3741 Год назад
great video!
@Tony-md7dr
@Tony-md7dr 4 года назад
2:10 If 1 and 2 got added first, then 7 and 8 would go to the other end. You add items from the opposite end than where you remove items.
@ehudklein
@ehudklein 3 года назад
+1 on the doubly linked list
@josiahdavid7735
@josiahdavid7735 2 года назад
Thanks a lot man!!!!!
@michaelfulton8972
@michaelfulton8972 2 года назад
WHAT IF WE HAD A MAP WHERE THE VALUE IS A POINTER TO THE NODE
@paulonteri
@paulonteri 3 года назад
Nice explanation!
@rajhpking
@rajhpking 4 года назад
Hi @bytebybyte u r earlier videos where u sit down and explains the problem and solves it was very effective than present few videos. Please start again same series of videos. Also explain how to use academic algorithms to solve leetcode problems. I find them very different and none of algorithm matches to most of leetcode problems.
@sudhanshupandey8129
@sudhanshupandey8129 4 года назад
Having a problem with DP problems.
@mskumar225
@mskumar225 4 года назад
@Byte By Byte we are not storing which element is the least recently used in the map. How do we know that 3 is the next least recently used element from the map? So, how we can directly go to that element from the list and delete it when we try to get the next element?
@ByteByByte
@ByteByByte 4 года назад
We are maintaining the order in the linked list. So you remove the item from the end of the list and then looking it up in the map to remove it from there as well
@TP-xt4sv
@TP-xt4sv 3 года назад
Am I the only one who think The person, who posted it, is really hot?
Далее
LRU Cache - Twitch Interview Question - Leetcode 146
17:49
LeetCode 146. LRU Cache (Algorithm Explained)
18:00
Просмотров 117 тыс.
Сколько стоят роды мечты?
00:59
Просмотров 835 тыс.
LRU Cache -  Explanation, Java Implementation and Demo
23:41
Implement LRU Cache | Leetcode
17:05
Просмотров 273 тыс.
How I would learn Leetcode if I could start over
18:03
Просмотров 509 тыс.
My 10 “Clean” Code Principles (Start These Now)
15:12
Google Coding Interview With A Competitive Programmer
54:17
Тайна синего экрана LG
0:56
Просмотров 74 тыс.
Yangi iPhone 16 chiqdi! #iphone #apple
0:59
Просмотров 429 тыс.
PlayStation 5 Pro Console - Reveal Trailer
1:05
Просмотров 2,3 млн