LFU Cache I – Single Link List

The motivation for this post was a LeetCode challenge titled:  LFU Cache for which I would like to develop a set of put() and get() methods that operate in O(1) running time. If you wish to take a look at the challenge you may find it at the following URL:  https://leetcode.com/problems/lfu-cache/

The actual challenge does not require O(1) methods but I read the following statement:

Follow up:

Could you do both operations in O(1) time complexity? Continue reading “LFU Cache I – Single Link List”