From 91d72168c25503d1d819102c5022280232961bdf Mon Sep 17 00:00:00 2001 From: Jonghwan Lee <123362165+0224LJH@users.noreply.github.com> Date: Thu, 23 Oct 2025 23:43:51 +0900 Subject: [PATCH] =?UTF-8?q?[20251023]=20PGM/=20Lv2=20/=20=EB=91=90=20?= =?UTF-8?q?=ED=81=90=20=ED=95=A9=20=EA=B0=99=EA=B2=8C=20=ED=95=98=EA=B8=B0?= =?UTF-8?q?=20/=20=EC=9D=B4=EC=A2=85=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1\352\262\214 \355\225\230\352\270\260.md" | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 "0224LJH/202510/23 PGM \353\221\220 \355\201\220 \355\225\251 \352\260\231\352\262\214 \355\225\230\352\270\260.md" diff --git "a/0224LJH/202510/23 PGM \353\221\220 \355\201\220 \355\225\251 \352\260\231\352\262\214 \355\225\230\352\270\260.md" "b/0224LJH/202510/23 PGM \353\221\220 \355\201\220 \355\225\251 \352\260\231\352\262\214 \355\225\230\352\270\260.md" new file mode 100644 index 00000000..b7dd4f53 --- /dev/null +++ "b/0224LJH/202510/23 PGM \353\221\220 \355\201\220 \355\225\251 \352\260\231\352\262\214 \355\225\230\352\270\260.md" @@ -0,0 +1,62 @@ +```java +import java.io.*; +import java.util.*; + +class Solution { + public int solution(int[] queue1, int[] queue2) { + int[] arr = new int[queue1.length + queue2.length]; + int len = arr.length; + for (int i = 0; i < queue1.length; i++){ + arr[i] = queue1[i]; + } + for (int i = 0; i < queue2.length; i++){ + arr[queue1.length+i] = queue2[i]; + } + + long total = 0; + long goal = 0; + long cur = arr[0]; + int start = 0; + int end = 0; + + for (int i = 0; i = len) break; + cur+=arr[end]; + + + } else if (cur < goal){ + end++; + if (end >= len) break; + cur+=arr[end]; + } else{ + if (arr[start] > goal) return -1; + + cur-=arr[start]; + start++; + } + } + + if (answer == Integer.MAX_VALUE) answer = -1; + + + + return answer; + } +} +```