From 7f1a0d8fc96fd53947abc010a8c52cdf23650c9d Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Wed, 22 Oct 2025 17:49:47 +0900 Subject: [PATCH] =?UTF-8?q?[20251022]=20PGM=20/=20Lv2=20/=20[1=EC=B0=A8]?= =?UTF-8?q?=EC=BA=90=EC=8B=9C=20/=20=EC=9D=B4=EA=B0=95=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1\354\260\250]\354\272\220\354\213\234.md" | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 "lkhyun/202510/22 PGM Lv2 [1\354\260\250]\354\272\220\354\213\234.md" diff --git "a/lkhyun/202510/22 PGM Lv2 [1\354\260\250]\354\272\220\354\213\234.md" "b/lkhyun/202510/22 PGM Lv2 [1\354\260\250]\354\272\220\354\213\234.md" new file mode 100644 index 00000000..4ec5cc2a --- /dev/null +++ "b/lkhyun/202510/22 PGM Lv2 [1\354\260\250]\354\272\220\354\213\234.md" @@ -0,0 +1,25 @@ +```java +import java.util.*; +class Solution { + public int solution(int cacheSize, String[] cities) { + int answer = 0; + List cache = new LinkedList<>(); + + for(String c : cities){ + String city = c.toLowerCase(); + if(cache.contains(city)){ + cache.remove(city); + cache.add(city); + answer++; + }else{ + cache.add(city); + answer+=5; + } + if(cache.size() > cacheSize){ + cache.remove(0); + } + } + return answer; + } +} +```