From 6a8631066e80e371be1610e860f51e7296607d7f Mon Sep 17 00:00:00 2001 From: tgyuuAn Date: Fri, 15 Nov 2024 01:37:54 +0900 Subject: [PATCH] 2024-11-15 --- tgyuuAn/README.md | 1 + .../Cubeeditor.py" | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 "tgyuuAn/\354\235\264\353\266\204 \355\203\220\354\203\211/Cubeeditor.py" diff --git a/tgyuuAn/README.md b/tgyuuAn/README.md index eef13130..5e4a11d6 100644 --- a/tgyuuAn/README.md +++ b/tgyuuAn/README.md @@ -86,4 +86,5 @@ | 77차시 | 2024.09.27 | 구현 | 표 병합 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/247 | 78차시 | 2024.10.06 | 그리디 | 풍선 터뜨리기 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/250 | 79차시 | 2024.10.12 | 이분 매칭 | 책 나눠주기 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/251 +| 81차시 | 2024.11.15 | 이분 탐색 | Cubeeditor | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/255 --- diff --git "a/tgyuuAn/\354\235\264\353\266\204 \355\203\220\354\203\211/Cubeeditor.py" "b/tgyuuAn/\354\235\264\353\266\204 \355\203\220\354\203\211/Cubeeditor.py" new file mode 100644 index 00000000..630b1707 --- /dev/null +++ "b/tgyuuAn/\354\235\264\353\266\204 \355\203\220\354\203\211/Cubeeditor.py" @@ -0,0 +1,28 @@ +from collections import defaultdict +import sys + +def input(): return sys.stdin.readline().rstrip() + +_input = input() + +def check(string, mid): + temp = defaultdict(int) + for start_idx in range(len(string)-mid+1): + now = string[start_idx:start_idx+mid] + temp[now] += 1 + if temp[now] >=2 : return True + return False + +answer = 0 +left = 0 +right = len(_input) +while left+1 < right: + mid = (left+right)//2 + + # 만약 해당 버퍼 크기에 답이 있다면 + if check(_input, mid): + answer = mid + left = mid + else: right = mid + +print(answer) \ No newline at end of file