From 0f7016010ca19bc2c0c1017248decc82abc617aa Mon Sep 17 00:00:00 2001 From: HyowonSin Date: Fri, 25 Aug 2023 21:00:00 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20PGS=5F=EB=91=90=EA=B0=9C=EB=BD=91?= =?UTF-8?q?=EC=95=84=EC=84=9C=EB=8D=94=ED=95=98=EA=B8=B0=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 생각이 잘 못 해서 이상하게 풀었다. 레벨 1 --- ...34\353\215\224\355\225\230\352\270\260.py" | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 "HyowonSin/season2/_230825/PGS_\353\221\220\352\260\234\353\275\221\354\225\204\354\204\234\353\215\224\355\225\230\352\270\260.py" diff --git "a/HyowonSin/season2/_230825/PGS_\353\221\220\352\260\234\353\275\221\354\225\204\354\204\234\353\215\224\355\225\230\352\270\260.py" "b/HyowonSin/season2/_230825/PGS_\353\221\220\352\260\234\353\275\221\354\225\204\354\204\234\353\215\224\355\225\230\352\270\260.py" new file mode 100644 index 0000000..827586a --- /dev/null +++ "b/HyowonSin/season2/_230825/PGS_\353\221\220\352\260\234\353\275\221\354\225\204\354\204\234\353\215\224\355\225\230\352\270\260.py" @@ -0,0 +1,21 @@ +def solution(numbers): + answer = set() + + arr = sorted(numbers) + arr2 = set() + + for i in range(len(arr)-1): + if arr[i] == arr[i+1]: + arr2.add(arr[i]) + + arr3 = list(set(arr)) + + for i in range(len(arr3)): + for j in range(i+1, len(arr3)): + num = arr3[i] + arr3[j] + answer.add(num) + + for i in arr2: + answer.add(i+i) + + return sorted(list(answer)) From bff384566963dcbd13247acd3b595687aaa6585c Mon Sep 17 00:00:00 2001 From: HyowonSin Date: Fri, 25 Aug 2023 21:03:05 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20PGS=5F=EB=AC=B8=EC=9E=90=EC=97=B4?= =?UTF-8?q?=EC=95=95=EC=B6=95=20=EB=AC=B8=EC=A0=9C=20=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 탐색 범위가 끝까지 갈 필요가 없었다. 반복문 안에서 최솟값을 바로 찾는 것이 좋다. 레벨 2 --- ...20\354\227\264\354\225\225\354\266\225.py" | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 "HyowonSin/season2/_230825/PGS_\353\254\270\354\236\220\354\227\264\354\225\225\354\266\225.py" diff --git "a/HyowonSin/season2/_230825/PGS_\353\254\270\354\236\220\354\227\264\354\225\225\354\266\225.py" "b/HyowonSin/season2/_230825/PGS_\353\254\270\354\236\220\354\227\264\354\225\225\354\266\225.py" new file mode 100644 index 0000000..edd8e87 --- /dev/null +++ "b/HyowonSin/season2/_230825/PGS_\353\254\270\354\236\220\354\227\264\354\225\225\354\266\225.py" @@ -0,0 +1,28 @@ +def solution(s): + arr = [] + for i in range(1, len(s) + 1): + index = 0 + count = 1 + temp = "" + while True: + if index+i >= len(s): + if count != 1: + temp += str(count) + temp += s[index:] + break + if s[index:index + i] == s[index + i:index + i + i]: + count += 1 + else: + if count != 1: + temp += str(count) + temp += s[index:index+i] + count = 1 + index += i + if index == len(s) - 1: + if count != 1: + temp += str(count) + temp += s[index] + break + arr.append(temp) + answer = min(map(lambda x: len(x), arr)) + return answer