Skip to content

Commit

Permalink
2024-03-10
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Mar 10, 2024
1 parent 512b3bf commit ecf5ee0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions tgyuuAn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@
| 38μ°¨μ‹œ | 2023.02.15 | DP | <a href="https://www.acmicpc.net/problem/2749">ν”Όλ³΄λ‚˜μΉ˜ 수 3</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/137
| 39μ°¨μ‹œ | 2023.02.18 | DP | <a href="https://www.acmicpc.net/problem/7579">μ•±</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/139
| 40μ°¨μ‹œ | 2023.02.21 | DP | <a href="https://www.acmicpc.net/problem/31413">μž…λŒ€</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/142
| 42μ°¨μ‹œ | 2024.03.10 | 이뢄 탐색 | <a href="https://school.programmers.co.kr/learn/courses/30/lessons/64062">징검닀리 κ±΄λ„ˆκΈ°</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/157
---
Original file line number Diff line number Diff line change
@@ -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<right:
mid = (left+right)//2

if check(mid, stones, k): # mid λͺ…이 건널 수 μžˆμ„ 경우 κ±΄λ„ˆλŠ” 수λ₯Ό 더 늘림
left = mid
answer = mid

else:
right = mid

return answer

0 comments on commit ecf5ee0

Please sign in to comment.