From 1239491b2354412cca73937cc74cfc544c8388a6 Mon Sep 17 00:00:00 2001 From: LiiNi-coder <97495437+LiiNi-coder@users.noreply.github.com> Date: Wed, 19 Nov 2025 23:59:06 +0900 Subject: [PATCH] =?UTF-8?q?[20251119]=20PGM=20/=20LV2=20/=20=ED=83=9D?= =?UTF-8?q?=EB=B0=B0=EC=83=81=EC=9E=90=20/=20=EC=9D=B4=EC=9D=B8=ED=9D=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...35\353\260\260\354\203\201\354\236\220.md" | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 "LiiNi-coder/202511/19 PGM \355\203\235\353\260\260\354\203\201\354\236\220.md" diff --git "a/LiiNi-coder/202511/19 PGM \355\203\235\353\260\260\354\203\201\354\236\220.md" "b/LiiNi-coder/202511/19 PGM \355\203\235\353\260\260\354\203\201\354\236\220.md" new file mode 100644 index 00000000..6ea55ca1 --- /dev/null +++ "b/LiiNi-coder/202511/19 PGM \355\203\235\353\260\260\354\203\201\354\236\220.md" @@ -0,0 +1,43 @@ +```java +import java.util.*; + +class Solution { + public int solution(int[] order) { + int answer = 0; + Queue main = new LinkedList<>(); + for(int i = 1; i <= order.length; i++) + main.offer(i); + + Deque sub = new ArrayDeque<>(); + int index = 0; + + for(int target : order){ + while(true){ + if(!main.isEmpty() && main.peek() <= target){ + if(main.peek() == target){ + main.poll(); + answer++; + + break; + } else { + sub.offer(main.poll()); + } + } else { + if(!sub.isEmpty() && sub.peek() == target){ + sub.poll(); + answer++; + } + + + else { + return answer; + } + break; + } + } + } + return answer; + } +} + +```