Implement LRU Cache | Leetcode

preview_player
Показать описание

In case you are thinking to buy courses, please check below:

Watch at 1.25x for better experience ..
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------

#dsa​ #striver #leetcode
Рекомендации по теме
Комментарии
Автор

DSA Playlists in the comment section ..

takeUforward
Автор

For some questions even if I have solved the question previously, I do watch your video for crystal clear explanation. Such an amazing teacher you are bhaiya .

tulika
Автор

One of the finest explanations of LRU Cache. God bless you Striver and more power to you. Such impeccable energy and knowledge of data structures is rarely seen at tandem.

swaroopchakraborty
Автор

This course have saved my life. thank you so much. i would have never built confidence in solving problems if it wasn't for u

ankushrai
Автор

That much energy you put, motivating me to stay awake and study. Thanks 💖

binod
Автор

That "just is case" has saperate feeling 💻😂

anuraggoswami
Автор

Great explanation, the only note for (11:23) is that repositioning node in doubly linked list doesn't necessarily require deleting node and creating a new one, it may be enough to update the node (and its neighbors) pointers, thereby preserving address of the node unchanged.

eldarzakirov
Автор

This video helped me clear 2nd technical round and eventually get placed at a dream company that came to our college 2 days ago.

Thank you so much for making such quality content!

saptarshidas
Автор

If take you forward was not created i would have been literally aiming for 3.5 pkg but because of take you forward i got my concepts cleared and ready to be at product based company with a lot of confidence💯Thanks Striver Bhai✌️🙏

masterroyjones
Автор

Do we really need to update the address in Hashmap when moving the node to the front? I believe we could just re-adjust the pointers of the existing node. that way there is no need to update the map while updating the frequency. node address remains same.

piyusht
Автор

Why are we deleting the nodes and creating new ones when they shift? We can just manipulate the pointers (prev & next) such that the same node in the memory is pointed to by the head (ie is the first element). Open to suggestions but I think that is a solid way to not modify the hashmap on get operations.

sanatbhalla
Автор

if you are facing TLE, change the get function like below.

int get(int _key) {

node* resnode=ump[_key];
int res=resnode->val;


addnode(new node(_key, res));
ump[_key]=head->next;
delete(resnode);
return res;
}
return -1;
}

sayanganguly
Автор

Nice video, I've a question here - For the operation . get(3), you are trying to delete the entry from the middle of the DLL and insert at the front if my understanding is correct. If that's true, my question is- the time complexity of deleting a node from the middle of a DLL is not 0(1), right?

rajeshg
Автор

Brother, I envy your enthusiasm while teaching. Great video. Thanks a lot.

ayanSaha
Автор

For maintaining the order can we not just change the links so that head.next becomes the node that is getting used and the next for that node and prev are adjusted accordingly ? Why to delete the node and add a new one ?

yogeshedekar
Автор

At first i thought whiteboard is too old school. It might be boring. But after seeing the whole video .I definitely can see your energy level is much higher and thus it becomes more lively and easy to understand. So in short it seems that this style od teaching turns out to be awesome.

ankursharma
Автор

Great video! thanks. However, the address of the node wouldn't change after deletion. We are just changing the pointers of the nodes in the DLL.

sugun
Автор

striver did you even thought that you would get so much love from students all over India, from working at google, to giving best content, reaching 500k subs, hatsoff man❤❤

jeevan-
Автор

one question, if a node already exists and we are asked to update it, why are we updating the node address in the hashmap since if you observe carefully then only the links and the data of the nodes are changing, the address/reference of the nodes themselves are not changing.

shuvbhowmickbestin
Автор

Thank You for your explaination videos bhaiya !! Cannot find better explanation than yours in web !!

bookalicious