From a2b5ed06bdfc892bda362e8a56878849aedb95e4 Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Fri, 7 Nov 2025 23:02:58 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[20251107]=20PGM=20/=20Lv3=20/=20=EC=88=AB?= =?UTF-8?q?=EC=9E=90=20=EA=B2=8C=EC=9E=84=20/=20=EC=9D=B4=EA=B0=95?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...3\354\236\220 \352\262\214\354\236\204.md" | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 "lkhyun/202511/07 PGM Lv2 \354\210\253\354\236\220 \352\262\214\354\236\204.md" diff --git "a/lkhyun/202511/07 PGM Lv2 \354\210\253\354\236\220 \352\262\214\354\236\204.md" "b/lkhyun/202511/07 PGM Lv2 \354\210\253\354\236\220 \352\262\214\354\236\204.md" new file mode 100644 index 00000000..5d767fee --- /dev/null +++ "b/lkhyun/202511/07 PGM Lv2 \354\210\253\354\236\220 \352\262\214\354\236\204.md" @@ -0,0 +1,44 @@ +```java +import java.util.*; + +class Solution { + public int solution(int[] A, int[] B) { + int answer = 0; + + List listB = new ArrayList<>(); + for (int num : B) { + listB.add(num); + } + Collections.sort(listB); + + for (int cur : A) { + int idx = binarySearch(listB, cur); + + if (idx < listB.size()) { + answer++; + listB.remove(idx); + } else { + listB.remove(0); + } + } + + return answer; + } + private int binarySearch(List list, int target) { + int left = 0; + int right = list.size(); + + while (left < right) { + int mid = (left + right) / 2; + + if (list.get(mid) <= target) { + left = mid + 1; + } else { + right = mid; + } + } + + return left; + } +} +``` From 37e27b506e424bc29c143ce828622118ccee7800 Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Fri, 7 Nov 2025 23:04:05 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[20251107]=20PGM=20/=20Lv3=20/=20=EC=88=AB?= =?UTF-8?q?=EC=9E=90=20=EA=B2=8C=EC=9E=84=20/=20=EC=9D=B4=EA=B0=95?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... PGM Lv3 \354\210\253\354\236\220 \352\262\214\354\236\204.md" | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "lkhyun/202511/07 PGM Lv2 \354\210\253\354\236\220 \352\262\214\354\236\204.md" => "lkhyun/202511/07 PGM Lv3 \354\210\253\354\236\220 \352\262\214\354\236\204.md" (100%) diff --git "a/lkhyun/202511/07 PGM Lv2 \354\210\253\354\236\220 \352\262\214\354\236\204.md" "b/lkhyun/202511/07 PGM Lv3 \354\210\253\354\236\220 \352\262\214\354\236\204.md" similarity index 100% rename from "lkhyun/202511/07 PGM Lv2 \354\210\253\354\236\220 \352\262\214\354\236\204.md" rename to "lkhyun/202511/07 PGM Lv3 \354\210\253\354\236\220 \352\262\214\354\236\204.md"