일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 자바스크립트
- DP
- Dynamic Programming
- 프로그래머스
- Baekjoon
- 파이썬
- Java
- 오블완
- 동적계획법
- LEVEL 2
- SQL
- programmers
- 티스토리챌린지
- 너비 우선 탐색
- group by
- Lv. 0
- 소프티어
- level 3
- bfs
- 깊이 우선 탐색
- softeer
- 백준
- Lv. 2
- dfs
- Lv. 1
- join
- SQL 고득점 KIT
- Python
- javascript
- Lv. 3
- Today
- Total
목록bfs (28)
몸과 마음이 건전한 SW 개발자
문제 링크https://www.acmicpc.net/problem/11724 정답 코드import sysfrom collections import dequeinput = sys.stdin.readlinen, m = map(int, input().split(" "))adjL = [[] for _ in range(n+1)]for i in range(m): start, to = map(int, input().split()) adjL[start].append(to) adjL[to].append(start)visited = [0 for _ in range(n+1)]answer = 0for j in range(1, n+1): if visited[j]: continue answ..
문제 링크https://school.programmers.co.kr/learn/courses/30/lessons/1829 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr정답 코드import java.util.Deque;import java.util.ArrayDeque;class Solution { public boolean isValid(int nr, int nc, int n, int m) { return 0 deque = new ArrayDeque(); // 주의 // deque.add..
문제 링크https://school.programmers.co.kr/learn/courses/30/lessons/92343?language=python3 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr정답 코드from collections import dequedef solution(info, edges): answer = 0 lenI = len(info) adjL = [[] for _ in range(lenI)] for start, to in edges: adjL[start].append(to) q = deque..
문제 링크https://school.programmers.co.kr/learn/courses/30/lessons/12978?language=python3 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr정답 코드from collections import dequedef solution(N, road, K): answer = 0 adjL = [[] for _ in range(N+1)] for start, to, time in road: adjL[start].append((to, time)) adjL[to].append((s..

문제 링크 https://school.programmers.co.kr/learn/courses/30/lessons/154538 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 정답 코드 function solution(x, y, n) { let visited = Array(1000001).fill().map(() => -1); const q = [x]; visited[x] = 0; while (q.length) { const cv = q.shift(); if (cv >= y) { continue; }; const visitedCV = visited[cv] ..
문제 링크 https://school.programmers.co.kr/learn/courses/30/lessons/154540 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 정답 코드 function solution(maps) { const answer = []; const n = maps.length; const m = maps[0].length; const dr = [-1, 1, 0, 0]; const dc = [0, 0, -1, 1]; const isValid = (nr, nc) => { return 0 0)); const bfs = (sr, sc)..