From 2936c4828fd24f23f4f3c04fb232c25c375f6c0a Mon Sep 17 00:00:00 2001 From: Jonghwan Lee <123362165+0224LJH@users.noreply.github.com> Date: Sun, 16 Nov 2025 12:23:15 +0900 Subject: [PATCH] =?UTF-8?q?[20251116]=20PGM=20/=20LV2=20/=20=EC=97=B0?= =?UTF-8?q?=EC=86=8D=20=EB=B6=80=EB=B6=84=20=EC=88=98=EC=97=B4=20/=20?= =?UTF-8?q?=EC=9D=B4=EC=A2=85=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0\353\266\204 \354\210\230\354\227\264.md" | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 "0224LJH/202511/16 PGM \354\227\260\354\206\215 \353\266\200\353\266\204 \354\210\230\354\227\264.md" diff --git "a/0224LJH/202511/16 PGM \354\227\260\354\206\215 \353\266\200\353\266\204 \354\210\230\354\227\264.md" "b/0224LJH/202511/16 PGM \354\227\260\354\206\215 \353\266\200\353\266\204 \354\210\230\354\227\264.md" new file mode 100644 index 00000000..67b7429a --- /dev/null +++ "b/0224LJH/202511/16 PGM \354\227\260\354\206\215 \353\266\200\353\266\204 \354\210\230\354\227\264.md" @@ -0,0 +1,42 @@ +```java +import java.io.*; +import java.util.*; + +class Solution { + + static HashSet set = new HashSet<>(); + + + public int solution(int[] elements) { + int len = elements.length; + + for (int i = 1; i <= len; i++){ + int curLen = i; + + int curSum = 0; + for (int j = 0; j < curLen; j++){ + curSum += elements[j]; + } + + int st = 0; + int end = curLen-1; + set.add(curSum); + + for (int j = 1; j < len; j++){ + curSum -= elements[st]; + st++; + end++; + end %= len; + curSum += elements[end]; + + set.add(curSum); + } + + } + + + int answer = set.size(); + return answer; + } +} +```