캐시에 있나?
캐시가 꽉 찼니?
def solution(cacheSize, cities):
answer = 0
cache=[]
for c in cities:
c=c.upper()
if c in cache:
# hit
answer+=1
# update the time
del cache[cache.index(c)]
cache.append(c)
else:
# miss
answer+=5
if len(cache)<cacheSize:
cache.append(c)
else:
# 최소값을 빼고 집어넣기
cache.append(c)
cache.pop(0)
return answer