Skip to content

Commit

Permalink
Merge branch 'main' into 44-tgyuuAn
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn authored Mar 24, 2024
2 parents 6af8851 + 7491076 commit d8db55b
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 @@ -44,5 +44,6 @@
| 40μ°¨μ‹œ | 2023.02.21 | DP | <a href="https://www.acmicpc.net/problem/31413">μž…λŒ€</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/142
| 41μ°¨μ‹œ | 2023.03.04 | DP | <a href="https://www.acmicpc.net/problem/2240">μžλ‘λ‚˜λ¬΄</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/148
| 42μ°¨μ‹œ | 2023.03.07 | DFS | <a href="https://www.acmicpc.net/problem/2239">μŠ€λ„μΏ </a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/152
| 43μ°¨μ‹œ | 2024.03.10 | 이뢄 탐색 | <a href="https://school.programmers.co.kr/learn/courses/30/lessons/64062">징검닀리 κ±΄λ„ˆκΈ°</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/157
| 44μ°¨μ‹œ | 2023.03.13 | 트라이 | <a href="https://www.acmicpc.net/problem/14725">개미꡴</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/159
---
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 d8db55b

Please sign in to comment.