leetcode

146. LRU Cache

Solution code

constructor

Time complexity: O(1)

Space complexity: O(capacity)

get

Time complexity: O(1)

Space complexity: O(capacity)

put

Time complexity: O(1)

Space complexity: O(capacity)