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 | 29 | 30 | 31 |
Tags
- 백준 17626
- spring security
- Spring Boot
- Kotlin
- 프로래머스
- 백준 15685
- 백준 16236
- 웹어플리케이션 서버
- 백준
- sql 기술면접
- JPA
- spring oauth
- MSA
- java 기술면접
- 백준 파이썬
- Spring
- MySQL
- Coroutine
- 프로그래머스
- 백준 19238
- 백준 16719
- 파이썬
- spring cloud
- springboot
- JVM
- 백준 17779
- re.split
- with recursive
- 백준 16235
- java
Archives
- Today
- Total
목록프로그래머스 네트워크 (1)
시작이 반

dfs, bfs를 사용하여 풀수있다. dfs로 문제를 해결하였다. dfs가 끝난이후 해당 node를 방문했는지 확인하고 그룹수를 증가시킨다. visited = list() def solution(n, computers): global visited visited = [False] * n answer = 0 for i in range(n): if not visited[i]: dfs(n, computers, i) answer += 1 return answer def dfs(n, computers, start): global visited, count visited[start] = True for i in range(n): if computers[start][i] == 1 and not visited[i]: ..
알고리즘/Programmers
2021. 3. 10. 18:26