diff --git a/tgyuuAn/README.md b/tgyuuAn/README.md index 1739d158..3439e261 100644 --- a/tgyuuAn/README.md +++ b/tgyuuAn/README.md @@ -87,4 +87,5 @@ | 78차시 | 2024.10.06 | 그리디 | 풍선 터뜨리기 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/250 | 79차시 | 2024.10.12 | 이분 매칭 | 책 나눠주기 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/251 | 80차시 | 2024.11.11 | 다익스트라 | 최소비용 구하기 2 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/254 +| 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