diff --git a/H0ngJu/README.md b/H0ngJu/README.md index dd774916..2d0adb09 100644 --- a/H0ngJu/README.md +++ b/H0ngJu/README.md @@ -3,6 +3,9 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | | :---: | :--------: | :------: | :-------------------------------------------------------------------------: | :-------------------------------------------------: | | 1차시 | 2024.03.05 | 큐 | [프로세스](https://school.programmers.co.kr/learn/courses/30/lessons/42587) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/151 | +| 2차시 | 2024.03.07 | 큐 | [다리를 지나는 트럭](https://school.programmers.co.kr/learn/courses/30/lessons/42583) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/153 | +| 3차시 | 2024.03.10 | 힙 | [N번째 큰 수](https://www.acmicpc.net/problem/2075) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/156 | +| 4차시 | 2024.03.13 | 힙 | [문제집](https://www.acmicpc.net/problem/1766) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/158 | | 5차시 | 2024.03.16 | 구현 | [요세푸스 문제](https://www.acmicpc.net/problem/1158) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/161 | --- diff --git "a/H0ngJu/\355\201\220/\353\213\244\353\246\254\353\245\274 \354\247\200\353\202\230\353\212\224 \355\212\270\353\237\255.py" "b/H0ngJu/\355\201\220/\353\213\244\353\246\254\353\245\274 \354\247\200\353\202\230\353\212\224 \355\212\270\353\237\255.py" new file mode 100644 index 00000000..31404e34 --- /dev/null +++ "b/H0ngJu/\355\201\220/\353\213\244\353\246\254\353\245\274 \354\247\200\353\202\230\353\212\224 \355\212\270\353\237\255.py" @@ -0,0 +1,26 @@ +from collections import deque + +def solution(bridge_length, weight, truck_weights): + time = 0 + onBridge = deque() # 현재 다리 위에 있는 트럭 + truckNum = 0 # 현재 다리 위에 있는 트럭 수 + sum = 0 # 현재 다리 위에 있는 트럭 무게의 합 + truck_weights = deque(truck_weights) + + while truck_weights or onBridge: + time += 1 + + # 트럭이 다리를 지나가는 경우 처리 + if onBridge and time - onBridge[0][1] >= bridge_length: + sum -= onBridge.popleft()[0] + truckNum -= 1 + + # 다음 트럭이 다리에 올라갈 수 있는 경우 처리 + # 트럭이 있고 합이 weight을 넘지 않으며, 수가 bridge_length를 넘기지 않는 경우 + if len(truck_weights) != 0 and sum + truck_weights[0] <= weight and truckNum + 1 <= bridge_length: + truck = truck_weights.popleft() # pop + onBridge.append((truck, time)) # 다리 위의 truck에 tuple 추가 + sum += truck # 무게 추가 + truckNum += 1 # 건너고 있는 트럭 추가 + + return time \ No newline at end of file diff --git "a/H0ngJu/\355\236\231/N\353\262\210\354\247\270 \355\201\260 \354\210\230.py" "b/H0ngJu/\355\236\231/N\353\262\210\354\247\270 \355\201\260 \354\210\230.py" new file mode 100644 index 00000000..5a22ef79 --- /dev/null +++ "b/H0ngJu/\355\236\231/N\353\262\210\354\247\270 \355\201\260 \354\210\230.py" @@ -0,0 +1,19 @@ +import sys +import heapq + +line = int(sys.stdin.readline().strip()) + +heap = [] +heapq.heapify(heap) + +for i in range(line): + data = list(map(int, sys.stdin.readline().strip().split())) + for s in data: + if len(heap) < line: + heapq.heappush(heap, s) + else: + if s > heap[0]: + heapq.heappop(heap) + heapq.heappush(heap, s) + +print(heap[0]) \ No newline at end of file diff --git "a/H0ngJu/\355\236\231/\353\254\270\354\240\234\354\247\221.py" "b/H0ngJu/\355\236\231/\353\254\270\354\240\234\354\247\221.py" new file mode 100644 index 00000000..b09a6544 --- /dev/null +++ "b/H0ngJu/\355\236\231/\353\254\270\354\240\234\354\247\221.py" @@ -0,0 +1,32 @@ +import sys +import heapq + +n, m = map(int, sys.stdin.readline().rstrip().split()) + +graph = [[] for _ in range(n+1)] +inDegree = [0 for _ in range(n+1)] +q = [] +answer = [] + +# 입력받아서 넣기 +for _ in range(m): + p1, p2 = map(int, sys.stdin.readline().rstrip().split()) + graph[p1].append(p2) # p1은 p2와 연결된 문제 + inDegree[p2] += 1 # 간선 추가 + +# 진입차수가 0이면 큐에 넣기 +for i in range(1, n+1): + if inDegree[i] == 0: + heapq.heappush(q, i) + +# answer에 넣고, 간선 제거 +while q: + prob = heapq.heappop(q) + answer.append(prob) + for i in graph[prob]: # 간선 제거 & 진입차수 0인 것들 처리 + inDegree[i] -= 1 + if inDegree[i] == 0: + heapq.heappush(q, i) + +for result in answer: + print(result, end=" ") \ No newline at end of file diff --git a/Munbin-Lee/README.md b/Munbin-Lee/README.md index 13e29ef2..1be0e769 100644 --- a/Munbin-Lee/README.md +++ b/Munbin-Lee/README.md @@ -38,4 +38,5 @@ | 35차시 | 2024.02.18 | 백트래킹 | 단어 마방진 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/140 | | 36차시 | 2024.02.21 | 문자열 | 회문은 회문아니야!! | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/143 | | 37차시 | 2024.03.05 | 백트래킹 | 석유 시추 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/150 | +| 37차시 | 2024.03.08 | 트라이 | 전화번호 목록 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/155 | --- diff --git "a/Munbin-Lee/\355\212\270\353\246\254/38-\354\240\204\355\231\224\353\262\210\355\230\270 \353\252\251\353\241\235.cpp" "b/Munbin-Lee/\355\212\270\353\246\254/38-\354\240\204\355\231\224\353\262\210\355\230\270 \353\252\251\353\241\235.cpp" new file mode 100644 index 00000000..5e5033f9 --- /dev/null +++ "b/Munbin-Lee/\355\212\270\353\246\254/38-\354\240\204\355\231\224\353\262\210\355\230\270 \353\252\251\353\241\235.cpp" @@ -0,0 +1,80 @@ +#include +#include + +using namespace std; + +struct Trie { + struct Node { + Node *children[10]{}; + bool isTerminal = false; + }; + + Node *root = new Node; + + bool insert(string &s) const { + auto cur = root; + + for (char ch: s) { + int digit = ch - '0'; + + if (!cur->children[digit]) { + cur->children[digit] = new Node(); + cur = cur->children[digit]; + continue; + } + + if (cur->children[digit]->isTerminal) { + return false; + } + + cur = cur->children[digit]; + } + + for (auto child: cur->children) { + if (child) { + return false; + } + } + + cur->isTerminal = true; + + return true; + } +}; + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(nullptr); + + auto solve = []() { + auto trie = new Trie; + + int n; + cin >> n; + + vector numbers(n); + + for (auto &number: numbers) { + cin >> number; + } + + for (auto number: numbers) { + if (!trie->insert(number)) { + cout << "NO\n"; + delete trie; + return; + } + } + + cout << "YES\n"; + }; + + int t; + cin >> t; + + while (t--) { + solve(); + } + + return 0; +} diff --git a/pknujsp/README.md b/pknujsp/README.md index ab833635..571b70d7 100644 --- a/pknujsp/README.md +++ b/pknujsp/README.md @@ -1,26 +1,26 @@ ## ✏️ 기록 -| 차시 | 날짜 | 문제유형 | 링크 | 풀이 | -| :----: | :--------: | :-------------: | :-----------------------------------------------------------------------------------------------: | :--------------------------------------------------------: | -| 1차시 | 2023.10.07 | BRUTE_FORCE | [BOJ_1107](https://www.acmicpc.net/problem/1107) | [#2](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/2) | -| 2차시 | 2023.10.09 | BRUTE_FORCE | [연속 부분 수열 합의 개수](https://school.programmers.co.kr/learn/courses/30/lessons/131701) | [#5](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/5) | -| 3차시 | 2023.10.11 | SORT | [최솟값 만들기](https://school.programmers.co.kr/learn/courses/30/lessons/12941?language=python3) | [#8](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/8) | -| 4차시 | 2023.10.13 | SORT | [튜플](https://school.programmers.co.kr/learn/courses/30/lessons/64065) | [#9](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/9) | -| 5차시 | 2023.10.15 | 구현 | [괄호 변환](https://school.programmers.co.kr/learn/courses/30/lessons/60058) | [#13](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/13) | -| 6차시 | 2023.10.17 | 탐색 | [쿼드압축 후 개수 세기](https://school.programmers.co.kr/learn/courses/30/lessons/68936) | [#16](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/16) | -| 7차시 | 2023.10.19 | 탐색 | [무인도 여행](https://school.programmers.co.kr/learn/courses/30/lessons/154540) | [#20](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/20) | -| 8차시 | 2023.10.21 | 탐색 | [거리두기 확인하기](https://school.programmers.co.kr/learn/courses/30/lessons/81302) | [#22](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/22) | -| 9차시 | 2023.10.23 | 맵 | [스킬 트리](https://school.programmers.co.kr/learn/courses/30/lessons/49993) | [#25](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/25) | -| 10차시 | 2023.10.25 | 구현 | [수식 최대화](https://school.programmers.co.kr/learn/courses/30/lessons/67257) | [#28](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/28) | -| 11차시 | 2023.10.27 | 리스트 | [영어 끝말잇기](https://school.programmers.co.kr/learn/courses/30/lessons/12981) | [#30](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/30) | -| 12차시 | 2023.10.30 | 큐 | [이중우선순위큐](https://school.programmers.co.kr/learn/courses/30/lessons/42628) | [#36](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/36) | -| 13차시 | 2023.11.01 | DP | [등굣길](https://school.programmers.co.kr/learn/courses/30/lessons/42898) | [#39](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/39) | -| 14차시 | 2023.11.03 | 맵 | [시소 짝꿍](https://school.programmers.co.kr/learn/courses/30/lessons/152996) | [#43](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/43) | -| 15차시 | 2023.11.05 | 수학 | [예상 대진표](https://school.programmers.co.kr/learn/courses/30/lessons/12985) | [#47](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/47) | -| 16차시 | 2023.11.08 | 수학 | [숫자 변환하기](https://school.programmers.co.kr/learn/courses/30/lessons/154538) | [#51](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/51) | -| 17차시 | 2023.11.10 | 스택 | [짝지어 제거하기](https://school.programmers.co.kr/learn/courses/30/lessons/12973) | [#54](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/54) | -| 18차시 | 2023.11.13 | 구현 | [키패드 누르기](https://school.programmers.co.kr/learn/courses/30/lessons/67256) | [#60](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/60) | -| 19차시 | 2023.11.17 | 구현 | [실패율](https://school.programmers.co.kr/learn/courses/30/lessons/42889) | [#64](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/64) | +| 차시 | 날짜 | 문제유형 | 링크 | 풀이 | +| :----: | :--------: | :-------------: | :-----------------------------------------------------------------------------------------------: | :---------------------------------------------------------: | +| 1차시 | 2023.10.07 | BRUTE_FORCE | [BOJ_1107](https://www.acmicpc.net/problem/1107) | [#2](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/2) | +| 2차시 | 2023.10.09 | BRUTE_FORCE | [연속 부분 수열 합의 개수](https://school.programmers.co.kr/learn/courses/30/lessons/131701) | [#5](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/5) | +| 3차시 | 2023.10.11 | SORT | [최솟값 만들기](https://school.programmers.co.kr/learn/courses/30/lessons/12941?language=python3) | [#8](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/8) | +| 4차시 | 2023.10.13 | SORT | [튜플](https://school.programmers.co.kr/learn/courses/30/lessons/64065) | [#9](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/9) | +| 5차시 | 2023.10.15 | 구현 | [괄호 변환](https://school.programmers.co.kr/learn/courses/30/lessons/60058) | [#13](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/13) | +| 6차시 | 2023.10.17 | 탐색 | [쿼드압축 후 개수 세기](https://school.programmers.co.kr/learn/courses/30/lessons/68936) | [#16](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/16) | +| 7차시 | 2023.10.19 | 탐색 | [무인도 여행](https://school.programmers.co.kr/learn/courses/30/lessons/154540) | [#20](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/20) | +| 8차시 | 2023.10.21 | 탐색 | [거리두기 확인하기](https://school.programmers.co.kr/learn/courses/30/lessons/81302) | [#22](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/22) | +| 9차시 | 2023.10.23 | 맵 | [스킬 트리](https://school.programmers.co.kr/learn/courses/30/lessons/49993) | [#25](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/25) | +| 10차시 | 2023.10.25 | 구현 | [수식 최대화](https://school.programmers.co.kr/learn/courses/30/lessons/67257) | [#28](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/28) | +| 11차시 | 2023.10.27 | 리스트 | [영어 끝말잇기](https://school.programmers.co.kr/learn/courses/30/lessons/12981) | [#30](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/30) | +| 12차시 | 2023.10.30 | 큐 | [이중우선순위큐](https://school.programmers.co.kr/learn/courses/30/lessons/42628) | [#36](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/36) | +| 13차시 | 2023.11.01 | DP | [등굣길](https://school.programmers.co.kr/learn/courses/30/lessons/42898) | [#39](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/39) | +| 14차시 | 2023.11.03 | 맵 | [시소 짝꿍](https://school.programmers.co.kr/learn/courses/30/lessons/152996) | [#43](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/43) | +| 15차시 | 2023.11.05 | 수학 | [예상 대진표](https://school.programmers.co.kr/learn/courses/30/lessons/12985) | [#47](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/47) | +| 16차시 | 2023.11.08 | 수학 | [숫자 변환하기](https://school.programmers.co.kr/learn/courses/30/lessons/154538) | [#51](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/51) | +| 17차시 | 2023.11.10 | 스택 | [짝지어 제거하기](https://school.programmers.co.kr/learn/courses/30/lessons/12973) | [#54](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/54) | +| 18차시 | 2023.11.13 | 구현 | [키패드 누르기](https://school.programmers.co.kr/learn/courses/30/lessons/67256) | [#60](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/60) | +| 19차시 | 2023.11.17 | 구현 | [실패율](https://school.programmers.co.kr/learn/courses/30/lessons/42889) | [#64](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/64) | | 20차시 | 2023.11.20 | 문자열 | [옹알이 (2)](https://school.programmers.co.kr/learn/courses/30/lessons/133499) | [#70](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/70) | | 21차시 | 2023.11.23 | 맵 | [의상](https://school.programmers.co.kr/learn/courses/30/lessons/42578) | [#73](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/73) | | 22차시 | 2023.11.26 | 그리디 | [구명보트](https://school.programmers.co.kr/learn/courses/30/lessons/42885) | [#79](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/79) | @@ -37,4 +37,5 @@ | 33차시 | 2024.02.06 | 큐 | [철로](https://www.acmicpc.net/problem/13334) | [#132](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/132) | | 34차시 | 2024.02.12 | BFS | [이분 그래프](https://www.acmicpc.net/problem/1707) | [#135](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/135) | | 35차시 | 2024.02.18 | 그리디 | [선물할인](https://www.acmicpc.net/problem/25947) | [#137](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/137) | -| 36차시 | 2024.02.21 | 이진탐색 | [휴게소 세우기](https://www.acmicpc.net/problem/1477) | [#143](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/143) | \ No newline at end of file +| 36차시 | 2024.02.21 | 이진탐색 | [휴게소 세우기](https://www.acmicpc.net/problem/1477) | [#143](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/143) | +| 37차시 | 2024.03.04 | 구현 | [n+1 카드게임](https://school.programmers.co.kr/learn/courses/30/lessons/258707) | [#149](https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/149) | \ No newline at end of file diff --git "a/pknujsp/\352\265\254\355\230\204/37-\354\271\264\353\223\234\352\262\214\354\236\204.py" "b/pknujsp/\352\265\254\355\230\204/37-\354\271\264\353\223\234\352\262\214\354\236\204.py" new file mode 100644 index 00000000..6f1f8396 --- /dev/null +++ "b/pknujsp/\352\265\254\355\230\204/37-\354\271\264\353\223\234\352\262\214\354\236\204.py" @@ -0,0 +1,53 @@ +def solution(coin, cards): + a = set(cards[:len(cards) // 3]) + b = set() + t = len(cards) + 1 + r = 1 + + for i in range(len(cards) // 3 + 1, len(cards), 2): + c1, c2 = cards[i - 1], cards[i] + b.add(c1) + b.add(c2) + + removed = False + # 현재 가지고 있는 카드 목록 중 n + 1이 가능한 경우 확인 + for x in list(a): + if t - x in a: + a.remove(t - x) + a.remove(x) + removed = True + break + + if removed: + r += 1 + continue + + # 코인으로 교환해서 얻을 수 있는 카드 중에서 n + 1이 되는 경우를 찾아야 함 + # 코인이 없으므로 종료 + if not coin: + break + + # `현재 갖고 있는 카드 + 얻을 수 있는 카드` = n + 1이 되는 경우를 확인 + for x in list(b): + if t - x in a: + a.remove(t - x) + b.remove(x) + removed = True + coin -= 1 + break + # 마지막 방법으로, 오직 교환으로 얻을 수 있는 카드 목록 중에서 n + 1이 되는 경우를 확인 + if not removed and coin >= 2: + for x in list(b): + if t - x in b: + b.remove(t - x) + b.remove(x) + removed = True + coin -= 2 + break + + # n + 1을 어떤 경우에도 못 만들면 종료 + if not removed: + break + r += 1 + + return r \ No newline at end of file diff --git "a/tgyuuAn/DFS/\354\212\244\353\217\204\354\277\240.py" "b/tgyuuAn/DFS/\354\212\244\353\217\204\354\277\240.py" new file mode 100644 index 00000000..7905dc67 --- /dev/null +++ "b/tgyuuAn/DFS/\354\212\244\353\217\204\354\277\240.py" @@ -0,0 +1,78 @@ +import sys + +def input(): return sys.stdin.readline().rstrip() + +board = [] + +for _ in range(9): board.append(list(input())) + +def dfs(board, now_row, now_col): + + # 이미 들어있는 칸일 경우 + if board[now_row][now_col] != "0": + new_row = now_row + new_col = now_col + 1 + + if new_col >= 9: + new_col = 0 + new_row += 1 + + # 스도쿠 완성 + if new_row >= 9: return board + + temp = dfs(board, new_row, new_col) + + if temp is not None: return temp + + # 비어있는 칸일 경우 + else: + need_number = { str(x) for x in range(1,10) } + + # 가로 행 검사 + for col in range(9): + if board[now_row][col] != "0": + need_number.discard(board[now_row][col]) + + # 세로 행 검사 + for row in range(9): + if board[row][now_col] != "0": + need_number.discard(board[row][now_col]) + + # 3X3 검사 + temp_row = (now_row//3)*3 + temp_col = (now_col//3)*3 + for inner_row in range(temp_row, temp_row+3): + for inner_col in range(temp_col, temp_col+3): + if board[inner_row][inner_col] != "0": + need_number.discard(board[inner_row][inner_col]) + + # 만약 넣을 수 있는것이 없으면 None을 리턴 + if len(need_number) == 0: return None + + need_number = sorted(list(map(int,need_number))) + + for dedicate_number in need_number: + board[now_row][now_col] = str(dedicate_number) + + new_row = now_row + new_col = now_col + 1 + + if new_col >= 9: + new_col = 0 + new_row += 1 + + # 스도쿠 완성 + if new_row >= 9: return board + + temp = dfs(board, new_row, new_col) + + if temp is not None: return temp + + board[now_row][now_col] = "0" + + return None + +answer = dfs(board, 0, 0) + +for row in answer: + print("".join(row)) \ No newline at end of file diff --git a/tgyuuAn/README.md b/tgyuuAn/README.md index f608a203..5fd3dcb3 100644 --- a/tgyuuAn/README.md +++ b/tgyuuAn/README.md @@ -39,8 +39,12 @@ | 35차시 | 2023.01.25 | 이분 탐색 | 공유기 설치 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/120 | 36차시 | 2023.02.04 | BFS | 로봇 청소기 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/126 | 37차시 | 2023.02.04 | BFS | 교환 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/131 -| 38차시 | 2023.02.15 | DP | 피보나치 수 3 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/137 +| 38차시 | 2023.02.15 | DP | 피보나치 수 3 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/138 | 39차시 | 2023.02.18 | DP | | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/139 | 40차시 | 2023.02.21 | DP | 입대 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/142 | 41차시 | 2023.03.04 | DP | 자두나무 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/148 +| 42차시 | 2023.03.07 | DFS | 스도쿠 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/152 +| 43차시 | 2024.03.10 | 이분 탐색 | 징검다리 건너기 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/157 +| 44차시 | 2023.03.13 | 트라이 | 개미굴 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/159 +| 45차시 | 2023.03.16 | 트라이 | 트라이 | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/162 --- diff --git "a/tgyuuAn/\354\235\264\354\247\204 \355\203\220\354\203\211/\353\260\260\354\227\264\354\227\220\354\204\234 \354\235\264\353\217\231.py" "b/tgyuuAn/\354\235\264\353\266\204 \355\203\220\354\203\211/\353\260\260\354\227\264\354\227\220\354\204\234 \354\235\264\353\217\231.py" similarity index 100% rename from "tgyuuAn/\354\235\264\354\247\204 \355\203\220\354\203\211/\353\260\260\354\227\264\354\227\220\354\204\234 \354\235\264\353\217\231.py" rename to "tgyuuAn/\354\235\264\353\266\204 \355\203\220\354\203\211/\353\260\260\354\227\264\354\227\220\354\204\234 \354\235\264\353\217\231.py" diff --git "a/tgyuuAn/\354\235\264\353\266\204 \355\203\220\354\203\211/\354\247\225\352\262\200\353\213\244\353\246\254 \352\261\264\353\204\210\352\270\260.py" "b/tgyuuAn/\354\235\264\353\266\204 \355\203\220\354\203\211/\354\247\225\352\262\200\353\213\244\353\246\254 \352\261\264\353\204\210\352\270\260.py" new file mode 100644 index 00000000..bbe6c556 --- /dev/null +++ "b/tgyuuAn/\354\235\264\353\266\204 \355\203\220\354\203\211/\354\247\225\352\262\200\353\213\244\353\246\254 \352\261\264\353\204\210\352\270\260.py" @@ -0,0 +1,25 @@ +def check(mid, stones, k): + gap = 0 + for stone in stones: + if stone - mid < 0: gap += 1 + else: gap = 0 + + if gap >= k: return False + return True + +def solution(stones, k): + left = -1 + right = 200000001 + answer = 0 + + while left+1