Skip to content

Commit 0564594

Browse files
committed
Fix python/146_LRU_Cache
1 parent 5397bbe commit 0564594

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

python/146_LRU_Cache.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class LRUCache:
1+
class LRUCache(object):
22
def __init__(self, capacity):
33
"""
44
:type capacity: int
@@ -21,14 +21,12 @@ def get(self, key):
2121
else:
2222
return -1
2323

24-
def set(self, key, value):
24+
def put(self, key, value):
2525
"""
2626
:type key: int
2727
:type value: int
2828
:rtype: nothing
2929
"""
30-
if not key or not value:
31-
return None
3230
if key in self.cache:
3331
self.queue.remove(key)
3432
elif len(self.queue) == self.capacity:
@@ -48,7 +46,7 @@ def set(self, key, value):
4846
# self.dic[key] = v # set key as the newest one
4947
# return v
5048
#
51-
# def set(self, key, value):
49+
# def put(self, key, value):
5250
# if key in self.dic:
5351
# self.dic.pop(key)
5452
# else:

0 commit comments

Comments
 (0)