Notice
Recent Posts
Recent Comments
Link
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- private subnet ec2 ๋ก์ปฌ ์ ์
- s3 ์ด๋ฏธ์ง ๋ค์ด๋ก๋
- ์ ํจ์ค ์ค์ผ์ค๋ฌ
- jvm ๋ฐ๋ฐ๋ฅ๊น์ง ํํค์น๊ธฐ
- ์ ํจ์ค ๋น๋ ์ค๋ฅ
- ์คํํ๋ ๋ฏธ์ค
- aws saa ํฉ๊ฒฉ
- aws ์ฟ ํฐ
- docker ps -a
- ํ๋ก๊ทธ๋๋จธ์ค ์ปฌ๋ฌ๋ง๋ถ
- redis ์กฐํ
- JPA
- ํ๋ก๊ทธ๋๋จธ์ค ํฉ์นํ์์๊ธ
- docker
- nGrinder
- ์๋ฐ
- Entity
- redis ํ ์คํธ์ฝ๋
- AWS Certified Solutions Architect - Associate
- Kafka
- ํ์ดํผ๋ฐ์ด์
- ๋ค์ค ์ปจํ ์ด๋
- s3 ์ด๋ฏธ์ง ์ ์ฅ
- ํ๋ก๊ทธ๋๋จธ์ค
- prod docker-compose
- docker compose
- ์๋ฒ ํฐ์ง๋ ๋์ปค ์ฌ์คํ
- Codedeploy ์ค๋ฅ
- s3 log ์ ์ฅ
- docker-compose kafka
Archives
- Today
- Total
๐๐ข๐๐ โ๐๐๐ ๐๐๐ก๐๐ ๐๐๐๐โง
[Python] ํ๋ก๊ทธ๋๋จธ์ค ์์ด ๋๋ง์๊ธฐ & ํ๋ก๊ทธ๋๋จธ์ค ๋ฐฐ๋ฌ ๋ณธ๋ฌธ
๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ด๐ป/[๐๐ฒ๐ญ๐ก๐จ๐ง] ๐๐ฅ๐ ๐จ๐ซ๐ข๐ญ๐ก๐ฆ
[Python] ํ๋ก๊ทธ๋๋จธ์ค ์์ด ๋๋ง์๊ธฐ & ํ๋ก๊ทธ๋๋จธ์ค ๋ฐฐ๋ฌ
๐คRyusun๐ค 2023. 9. 5. 11:30#ํ๋ก๊ทธ๋๋จธ์ค ์์ด ๋๋ง์๊ธฐ
def solution(n, words):
i = 0
memo = set()
cnt = 1
while True:
if i == len(words):
return [0,0]
elif words[i] in memo :
return [i%n+1, cnt]
elif i != 0 and words[i][0] != words[i-1][-1]:
return [i % n + 1, cnt]
if i%n == n-1:
cnt += 1
memo.add(words[i])
i += 1
# ํ๋ก๊ทธ๋๋จธ์ค ๋ฐฐ๋ฌ
import heapq
def solution(N, road, K):
graph = [[] for _ in range(N+1)]
for i in range(len(road)):
a,b,c = road[i]
graph[a].append([b,c])
graph[b].append([a,c])
min_dist = [1e9] * (N+1)
return dijkstra(graph, min_dist, K)
def dijkstra(graph, min_dist, K):
queue = []
heapq.heappush(queue, [0, 1])
min_dist[1] = 0
while queue:
dist, node = heapq.heappop(queue)
if min_dist[node] > dist:
min_dist[node] = dist
for next_node, weight in graph[node]:
cost = min_dist[node] + weight
if cost < min_dist[next_node]:
min_dist[next_node] = cost
heapq.heappush(queue, [cost, next_node])
cnt = 0
for i in min_dist:
if i <= K:
cnt += 1
return cnt