https://school.programmers.co.kr/learn/courses/30/lessons/42579 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 풀이 방법1. 장르별 재생 횟수 저장2. 각 장르에 속한 노래의 저장3. 장르별 재생 횟수를 저장4. 곡 수대로 내림차순 정렬5. 정렬된 num의 순서대로 상위 2곡의 고유번호를 ArrayList에 저장import java.util.*;class Solution { public int[] solution(String[] genres, int[] plays) { ArrayList answer = new Array..
풀이BFS로도 DFS로도 풀 수 있는 문제이다.연결요소 유형이고, 방문했을 때, 방문한 곳을 0으로 바꿔준다는게 핵심이다!지금도 자꾸 함수를 외워서, 그리고 아주조금 생각하면서 풀고 있는데, 흰 종이를 가져와 그래프를 그림과 표로 방문해준 곳을 어떻게 방문표시를 해줄건지 생각하며 풀어보자. BFS로 풀기from collections import dequedx = [0, 0, -1, 1]dy = [-1, 1, 0, 0]def bfs(graph, x, y): queue = deque() queue.append((x, y)) graph[x][y] = 0 cnt = 1 while queue: x, y = queue.popleft() for..

BFS DFS이제는 그만 두려워하고, BFS DFS를 완전히 정복해보자. 예시문제는 백준의 BFS와 DFS이다https://www.acmicpc.net/problem/1260 아이디어입력 값 받기그래프 선언DFS/BFS 함수함수 실행 전체코드from collections import dequen, m, v = map(int, input().split())graph = [[False] * (n+1) for _ in range(n+1)]for i in range(m): x, y = map(int, input().split()) graph[x][y] = 1 graph[y][x] = 1# 방문 여부를 담을 리스트visited1 = [False] * (n+1)visited2 = [Fal..
Lv.2 프로세스from collections import dequedef solution(priorities, location): # 우선순위와 인덱스를 함께 저장 deq = deque([(priority, idx) for idx, priority in enumerate(priorities)]) cnt = 0 while deq: current = deq.popleft() if any(current[0] 모르는 함수enumerate()순서가 있는 자료형 (list, set, tuple, dictionary, string)을 입력으로 받았을 때, 인덱스와 값을 포함하여 리턴인덱스와 값을 동시에 접근하면서 루프를 돌리고 싶을 때 사용enumerate(..
기능개발https://school.programmers.co.kr/learn/courses/30/lessons/42586def solution(progresses, speeds): answer = [] for i in range(len(progresses)): days = (100 - progresses[i] + speeds[i] - 1) // speeds[i] answer.append(days) stack = [] score = answer[0] count = 1 for i in range(1, len(answer)): if score >= answer[i]: count += 1 ..
백준 15650 N과 M (2) 풀이 1 (’ ‘.join(map(str, j)))from itertools import combinationsn, m = map(int, input().split())numbers = [i for i in range(1, n+1)]for j in combinations(numbers, m): print(' '.join(map(str, j))) (2, 4) 이런식으로 출력되는데 map함수와 join 함수를 써서 출력하면 2 4 이렇게 출력된다. 풀이 2 print(*number)from itertools import combinationsn, m = map(int, input().split())numbers = [i for i in range(1, n+1)]f..
https://school.programmers.co.kr/learn/courses/30/lessons/64065 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr def solution(s): s = s[2:-2].split("},{") arr = [] for i in range(len(s)): s1 = s[i].split(",") arr.append(set(s1)) arr.sort(key=lambda x: len(x)) ans = set() res = [] for a in a..
- Total
- Today
- Yesterday
- 브루트 포스법
- 나는야 4학년 #5학년 까지 가보자구
- 백준10871번
- 단계10
- 25083번
- level3
- 백준2720번 #그리디 알고리즘
- 정보처리기사 실기 #정처기 실기 #2024년 2회 #정처기 2024년 2회 #공부법 # 꿀팁
- 25304번
- 백준17608번
- 이분탐색
- 백준 18258번
- level1 # 입출력과 사칙연산
- 명품 JAVA Programming - 황기태
- 올 겨울은 조금 따뜻할 것 같다.
- 백준 10828번 # 스택
- java #예외처리 #throw #throws
- java #추상클래스
- 12605번
- 자바 #자바문법 #자바기초 #참조형 #기본형
- object 클래스 # java
- level2
- 반복문
- Spring
- 백준14720 # 그리디 알고리즘 # greedy
- 스프링웹개발기초
- 2798블랙잭
- static #자바 메모리 구조 #멤버 변수
- 11034번
- heap area #stack area #static area #jvm
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |