topic:
I met for the first time:’2023/3/14-15:21’
Thought:
Simple simulation,Use the dictionary to make it,好像完全没用到双向Linked和LRU的Thought。。。I’m guilty,I can remember the air conditioner made in half a year ago。
answer就看Code的注释应该就能看懂,I will reply if I don’t understand。
Code:
1 | class LRUCache: |
Second solution
1 | class Node: |