soulmachine / leetcode

LeetCode题解,151道题完整版。
BSD 3-Clause "New" or "Revised" License
11.27k stars 3.43k forks source link

LRU Cache: Not necessary to update cacheMap after splice #89

Open nblintao opened 7 years ago

nblintao commented 7 years ago

In LRU Cache, after moving a node in the list to the front, it updated cacheMap[key] to cacheList.begin().

But I don't think the iterator to the node will be changed after splicing.